From a05178741833341a290bd32a33326cf3fe5d22e2 Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Sun, 21 Aug 2016 23:35:51 +0300 Subject: [PATCH] 'W' and 'H' args: width and height --- .sterm.rc | 12 ++++++------ src/sterm.c | 23 ++++++++++++++++++++--- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.sterm.rc b/.sterm.rc index 20c47a0..9b8d59f 100644 --- a/.sterm.rc +++ b/.sterm.rc @@ -215,12 +215,12 @@ keybind ctrl+alt+0 SwitchToTab 0 keybind alt+shift+Left MoveTabTo prev nowrap keybind alt+shift+Right MoveTabTo next nowrap -keybind alt+Up ScrollHistoryLineUp -keybind alt+Down ScrollHistoryLineDown -keybind alt+Prior ScrollHistoryPageUp -keybind alt+Next ScrollHistoryPageDown -keybind alt+Home ScrollHistoryTop -keybind alt+End ScrollHistoryBottom +keybind alt+Shift+Up ScrollHistoryLineUp +keybind alt+Shift+Down ScrollHistoryLineDown +keybind alt+Shift+Prior ScrollHistoryPageUp +keybind alt+Shift+Next ScrollHistoryPageDown +keybind alt+Shift+Home ScrollHistoryTop +keybind alt+Shift+End ScrollHistoryBottom # keypad translation for keymap (only!) keytrans reset diff --git a/src/sterm.c b/src/sterm.c index ced8576..b903c9b 100644 --- a/src/sterm.c +++ b/src/sterm.c @@ -882,9 +882,10 @@ static int checkEGG (const char *str) { int main (int argc, char *argv[]) { char *configfile = NULL; char *runcmd = NULL; - // + int optWidth = 80; + int optHeight = 25; + //dbgLogInit(); - // for (int f = 1; f < argc; f++) { if (argv[f][0] == '-' && checkEGG(argv[f])) exit(1); if (strcmp(argv[f], "-name") == 0) { ++f; continue; } @@ -897,6 +898,8 @@ int main (int argc, char *argv[]) { case 'w': case 'b': case 'R': + case 'W': + case 'H': ++f; break; case 'T': @@ -983,6 +986,20 @@ cfgdone: case 'R': if (++f < argc) runcmd = argv[f]; break; + case 'W': + if (++f < argc) { + optWidth = atoi(argv[f]); + if (optWidth < 2) optWidth = 2; + if (optWidth > 512) optWidth = 512; + } + break; + case 'H': + if (++f < argc) { + optHeight = atoi(argv[f]); + if (optHeight < 1) optHeight = 1; + if (optHeight > 512) optHeight = 512; + } + break; case 'e': /* eat all remaining arguments */ if (++f < argc) opt_cmd = &argv[f]; @@ -1006,7 +1023,7 @@ cfgdone: updateTabBar = 1; termidx = 0; curterm = k8t_termalloc(); - k8t_tmInitialize(curterm, 80, 25, opt_maxhistory); + k8t_tmInitialize(curterm, optWidth, optHeight, opt_maxhistory); // pixmap will be created in xinit() if (K8T_DATA(curterm)->execcmd != NULL) { free(K8T_DATA(curterm)->execcmd); K8T_DATA(curterm)->execcmd = NULL; } if (k8t_ttyNew(curterm) != 0) k8t_die("can't run process"); -- 2.11.4.GIT