fortrangoingonforty/fortty / d2717e3

Browse files

updates, fixes

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
d2717e35defd3c4c6b4ce6e49b77a4ad81c3d44a
Parents
4b8f2be
Tree
312674c

3 changed files

StatusFile+-
M c_src/freetype_helpers.c 9 3
M c_src/pty_helpers.c 2 3
M src/window/window.f90 7 1
c_src/freetype_helpers.cmodified
@@ -40,10 +40,16 @@ void fortty_ft_done_face(FT_Face face) {
4040
 /* Get font metrics for terminal cell sizing */
4141
 void fortty_ft_get_metrics(FT_Face face, int *cell_width, int *cell_height,
4242
                            int *ascender, int *descender) {
43
-    /* Use the scaled max advance from size metrics (26.6 fixed-point pixels).
44
-     * Note: face->max_advance_width is in font units (unscaled), not pixels!
43
+    /* For monospace fonts, get cell width from actual glyph advance of 'M'
44
+     * (max_advance can be wrong for some fonts like NotoSansMono)
4545
      */
46
-    *cell_width = face->size->metrics.max_advance >> 6;
46
+    FT_Error err = FT_Load_Char(face, 'M', FT_LOAD_DEFAULT);
47
+    if (err == 0) {
48
+        *cell_width = face->glyph->advance.x >> 6;
49
+    } else {
50
+        /* Fallback to max_advance if glyph load fails */
51
+        *cell_width = face->size->metrics.max_advance >> 6;
52
+    }
4753
 
4854
     /* Height from font metrics (in 1/64 pixels, convert to pixels) */
4955
     *ascender = face->size->metrics.ascender >> 6;
c_src/pty_helpers.cmodified
@@ -63,9 +63,8 @@ int fortty_pty_fork(const char *shell, int rows, int cols) {
6363
             }
6464
         }
6565
 
66
-        /* Execute shell as login shell */
67
-        /* Using -l flag for login shell behavior */
68
-        execlp(sh, sh, "-l", (char *)NULL);
66
+        /* Execute shell as interactive shell (not login) */
67
+        execlp(sh, sh, (char *)NULL);
6968
 
7069
         /* If exec fails */
7170
         perror("execlp");
src/window/window.f90modified
@@ -381,7 +381,13 @@ contains
381381
           pending_pane_action = PANE_ACTION_NAV_DOWN
382382
           return
383383
 
384
-        ! Pane navigation with vim keys: Cmd/Ctrl + hjkl
384
+      end select
385
+    end if
386
+
387
+    ! Pane navigation with vim keys: Super/Cmd + hjkl only (not Ctrl)
388
+    ! This allows Ctrl+L (clear), Ctrl+H, etc. to pass through to the shell
389
+    if (iand(mods, GLFW_MOD_SUPER) /= 0 .and. iand(mods, GLFW_MOD_CONTROL) == 0) then
390
+      select case (key)
385391
         case (GLFW_KEY_H)
386392
           pending_pane_action = PANE_ACTION_NAV_LEFT
387393
           return