fortrangoingonforty/fortty / 9d9074d

Browse files

Complete cursor style and blink configuration

Add TOML parsing for [cursor] section:
- style: "block", "underline", or "bar"/"beam"
- blink: true/false

Apply config values to terminal cursor on startup.
Authored by espadonne
SHA
9d9074df43987bd4e1b372601ec5594497bf33fc
Parents
09ed062
Tree
3858efc

2 changed files

StatusFile+-
M src/config/config.f90 14 0
M src/fortty.f90 4 0
src/config/config.f90modified
@@ -182,6 +182,20 @@ contains
182
     ! Terminal settings
182
     ! Terminal settings
183
     cfg%scrollback_lines = toml_get_integer(tf, 'terminal', 'scrollback_lines', cfg%scrollback_lines)
183
     cfg%scrollback_lines = toml_get_integer(tf, 'terminal', 'scrollback_lines', cfg%scrollback_lines)
184
 
184
 
185
+    ! Cursor settings
186
+    str_val = toml_get_string(tf, 'cursor', 'style', '')
187
+    if (len_trim(str_val) > 0) then
188
+      select case (trim(str_val))
189
+        case ('block')
190
+          cfg%cursor_style = 0
191
+        case ('underline')
192
+          cfg%cursor_style = 1
193
+        case ('bar', 'beam')
194
+          cfg%cursor_style = 2
195
+      end select
196
+    end if
197
+    cfg%cursor_blink = toml_get_logical(tf, 'cursor', 'blink', cfg%cursor_blink)
198
+
185
     ! Shell settings
199
     ! Shell settings
186
     str_val = toml_get_string(tf, 'shell', 'program', '')
200
     str_val = toml_get_string(tf, 'shell', 'program', '')
187
     if (len_trim(str_val) > 0) cfg%shell_program = str_val
201
     if (len_trim(str_val) > 0) cfg%shell_program = str_val
src/fortty.f90modified
@@ -192,6 +192,10 @@ program fortty
192
   call terminal_init(term, term_rows, term_cols)
192
   call terminal_init(term, term_rows, term_cols)
193
   call parser_init(parser)
193
   call parser_init(parser)
194
 
194
 
195
+  ! Apply cursor settings from config
196
+  term%cursor%style = cfg%cursor_style
197
+  term%cursor%blink = cfg%cursor_blink
198
+
195
   ! Open PTY with shell
199
   ! Open PTY with shell
196
   pty = pty_open("", term_rows, term_cols)  ! Empty string = use $SHELL
200
   pty = pty_open("", term_rows, term_cols)  ! Empty string = use $SHELL
197
 
201