Ticket #4175: 0001-My-squashed-CenterLine-commits.patch

File 0001-My-squashed-CenterLine-commits.patch, 2.5 KB (added by smartmic, 8 months ago)
  • lib/keybind.c

    From 1b4a63fbf00b80169f96f8091e2b53c54a9a5c33 Mon Sep 17 00:00:00 2001
    From: Martin Michel <dev@famic.de>
    Date: Sat, 16 Jan 2021 15:33:34 +0100
    Subject: [PATCH] My squashed CenterLine commits
    
    ---
     lib/keybind.c          |  1 +
     lib/keybind.h          |  1 +
     misc/mc.default.keymap |  1 +
     src/editor/edit.c      | 19 +++++++++++++++++++
     4 files changed, 22 insertions(+)
    
    diff --git a/lib/keybind.c b/lib/keybind.c
    index abd44d3e2..e441dcaa7 100644
    a b static name_keymap_t command_names[] = { 
    331331    ADD_KEYMAP_NAME (SyntaxOnOff), 
    332332    ADD_KEYMAP_NAME (SyntaxChoose), 
    333333    ADD_KEYMAP_NAME (ShowMargin), 
     334    ADD_KEYMAP_NAME (CenterLine), 
    334335    ADD_KEYMAP_NAME (OptionsSaveMode), 
    335336    ADD_KEYMAP_NAME (About), 
    336337    /* An action to run external script from macro */ 
  • lib/keybind.h

    diff --git a/lib/keybind.h b/lib/keybind.h
    index af019df09..ebb8e7211 100644
    a b enum 
    310310    CK_OptionsSaveMode, 
    311311    CK_About, 
    312312    CK_ShowMargin, 
     313    CK_CenterLine, 
    313314    CK_ShowTabTws, 
    314315    CK_SyntaxOnOff, 
    315316    CK_SyntaxChoose, 
  • misc/mc.default.keymap

    diff --git a/misc/mc.default.keymap b/misc/mc.default.keymap
    index 2931ddd0a..c5a02e0e6 100644
    a b ShowTabTws = alt-underline 
    369369SyntaxOnOff = ctrl-s 
    370370# SyntaxChoose = 
    371371# ShowMargin = 
     372# CenterLine = 
    372373Find = alt-enter 
    373374FilePrev = alt-minus 
    374375FileNext = alt-plus 
  • src/editor/edit.c

    diff --git a/src/editor/edit.c b/src/editor/edit.c
    index edda1f832..710e11e75 100644
    a b edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) 
    37643764            } 
    37653765        } 
    37663766        break; 
     3767    case CK_CenterLine: 
    37673768 
     3769        /* 
     3770         * Center cursor line in window, redraw window when cursor is in 
     3771         * bottom half of window 
     3772         */ 
     3773        if (edit->buffer.curs_line > edit->buffer.lines - w->lines / 2) 
     3774        { 
     3775            edit_save_size (edit); 
     3776            widget_set_size (w, w->y, w->x, w->lines / 2 + 2, w->cols); 
     3777            edit_move_display (edit, edit->buffer.curs_line - w->lines + 1); 
     3778            w->pos_flags = WPOS_KEEP_ALL; 
     3779            edit_update_screen (edit); 
     3780            widget_set_size_rect (w, &edit->loc_prev); 
     3781        } 
     3782        else if (edit->buffer.curs_line > edit->curs_row / 2) 
     3783        { 
     3784            edit_move_display (edit, edit->buffer.curs_line - w->lines / 2 + 1); 
     3785        } 
     3786        break; 
    37683787    case CK_Top: 
    37693788    case CK_MarkToFileBegin: 
    37703789        edit_move_to_top (edit);