Fixed bug: Home(Pos1) and End keys are working properly now.
This commit is contained in:
parent
1f1e48cebc
commit
b2c85170ad
4 changed files with 31 additions and 8 deletions
4
APKBUILD
4
APKBUILD
|
|
@ -26,10 +26,10 @@ package() {
|
|||
}
|
||||
|
||||
sha512sums="
|
||||
95b73a9ce945da4071f60007a5c57f288b68e0677b05f8a4ffc8c0a10940e5ed57e9df1840e6ce2741d471e15375cfb5a4a09edade51c6b4866160a3c507cd73 murx.c
|
||||
0a297bc9295533c76b9e4b271b0f4472bf6f36caca68a2480bb0a54d435972d5f205ff9cd272c7f9038dfe59e87840f8a342e636d6f31ce8659b13f05da1ef35 murx.c
|
||||
ca73b902d64fc9dc52d8d14b6c8ca6b494f4bea3f3602c29fd2909252668e110edff075c881e014e689d7c7d990dee2a4a96208276bae50243ca382adc5ead80 Makefile
|
||||
db9fe919bac2b4976efa6d760b1f917ec6fee88a4f2811ea4ac69334f6f24d522569c2cd3c3d087eb43cace659bf4c00f3c4097cc901d769b4e4000342d65c45 murx.1
|
||||
153e4c4d23e64b74119714790c3701cc3cb2883494237fb44974efb9fc95a9adbc9a3425b1ed93d6e14014d8b3861e08ce2ef658093cd3ea151d9cf9fdada07f README.md
|
||||
e7393bfcbf2a10d7251c0ae5f9fdc18534b7989bb6688fa71d0cd52eaea9db5744413963acdbefc66951d246b3f2db061168507b8bda2c516f992b9ce5ee0f72 README.md
|
||||
2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE
|
||||
4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS
|
||||
"
|
||||
|
|
|
|||
4
PKGBUILD
4
PKGBUILD
|
|
@ -8,10 +8,10 @@ url='https://codeberg.org/armin/murx'
|
|||
license=('Apache-2.0')
|
||||
depends=('glibc')
|
||||
source=('murx.c' 'Makefile' 'murx.1' 'README.md' 'LICENSE' 'AUTHORS')
|
||||
sha256sums=('ef7a6d215ec78876a7eb850eae5bb554011c4e12b4f0607f57d9195d9e2ba821'
|
||||
sha256sums=('50f141c6b6c42bdc13cf7018c2723b58e69fe0027e4f8befcd82dab598478852'
|
||||
'c683ed74c664ebb2a72603297367ed102afdf27e4d6cee47920db8632a8efa91'
|
||||
'd2219b9be02a6d588c593eb001c2c7f1ada845c4c72fa5837937d08192572678'
|
||||
'7b47bf380ba9c9c5defede500514fba6527c8202e64d8f9f622c09de7c5610e8'
|
||||
'624618abc7dbe0154bc304cf97ff414932215455a5d23ee731806b222c74681c'
|
||||
'31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4'
|
||||
'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb')
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ and `murx-root`.
|
|||
- Application cursor-key mode follows the active pane, so arrow navigation
|
||||
works in programs such as Midnight Commander. Menus and prompts use normal
|
||||
cursor-key mode; detaching restores normal cursor keys in the outer terminal.
|
||||
- Home (Pos1) and End use the pane’s `screen-256color` key sequences.
|
||||
- Multiple clients can attach to the same session. The most recently attached
|
||||
or resized client sets the session size; a larger client shows the session
|
||||
centred in its terminal, while a smaller client shows the top-left part.
|
||||
|
|
|
|||
30
murx.c
30
murx.c
|
|
@ -3313,10 +3313,12 @@ static void menu_key(Client *c, Session *s, const unsigned char *buf, size_t n,
|
|||
|
||||
static void client_feed(Client *c, Session *s, const unsigned char *buf, size_t n) {
|
||||
if (n > sizeof c->in - c->inlen) n = sizeof c->in - c->inlen;
|
||||
if (n == 0 && c->inlen == 1 && c->in[0] == 27 && c->escape_since &&
|
||||
if (n == 0 && c->escape_since &&
|
||||
now_ms() - c->escape_since >= 100) {
|
||||
Scrollback *view = scrollback_current(c, s);
|
||||
if (view) scrollback_remove(scrollback_slot(c, view->pane));
|
||||
if (!view && !c->prefix_pending && s->cur && s->cur->active)
|
||||
pane_write(s->cur->active, c->in, c->inlen);
|
||||
c->prefix_pending = 0;
|
||||
c->inlen = 0;
|
||||
c->escape_since = 0;
|
||||
|
|
@ -3384,8 +3386,21 @@ static void client_feed(Client *c, Session *s, const unsigned char *buf, size_t
|
|||
i++;
|
||||
continue;
|
||||
}
|
||||
size_t j = i;
|
||||
while (j < c->inlen && c->in[j] != c->prefix) j++;
|
||||
/* screen-256color describes Home and End as CSI 1~ and CSI 4~. */
|
||||
if (p[0] == 27) {
|
||||
if (left == 1) break;
|
||||
if (p[1] == '[' || p[1] == 'O') {
|
||||
if (left == 2) break;
|
||||
if (p[2] == 'H' || p[2] == 'F') {
|
||||
if (s->cur && s->cur->active)
|
||||
pane_write(s->cur->active, p[2] == 'H' ? "\x1b[1~" : "\x1b[4~", 4);
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
size_t j = i + 1;
|
||||
while (j < c->inlen && c->in[j] != c->prefix && c->in[j] != 27) j++;
|
||||
if (s->cur && s->cur->active) pane_write(s->cur->active, c->in + i, j - i);
|
||||
i = j;
|
||||
}
|
||||
|
|
@ -3393,7 +3408,9 @@ static void client_feed(Client *c, Session *s, const unsigned char *buf, size_t
|
|||
memmove(c->in, c->in + i, c->inlen - i);
|
||||
c->inlen -= i;
|
||||
}
|
||||
if (c->inlen == 1 && c->in[0] == 27 && (scrollback_current(c, s) || c->prefix_pending)) {
|
||||
if (c->inlen && c->in[0] == 27 &&
|
||||
((!c->mode && !c->locked && !scrollback_current(c, s) && !c->prefix_pending) ||
|
||||
(c->inlen == 1 && (scrollback_current(c, s) || c->prefix_pending)))) {
|
||||
if (!c->escape_since) c->escape_since = now_ms();
|
||||
} else c->escape_since = 0;
|
||||
}
|
||||
|
|
@ -3663,6 +3680,11 @@ static void run_server(Session *s) {
|
|||
}
|
||||
|
||||
int timeout = 200;
|
||||
for (Client *c = s->clients; c; c = c->next) {
|
||||
if (!c->escape_since) continue;
|
||||
long long remaining = 100 - (now_ms() - c->escape_since);
|
||||
if (remaining < timeout) timeout = remaining > 0 ? (int)remaining : 0;
|
||||
}
|
||||
int pr = poll(pfds, (nfds_t)idx, timeout);
|
||||
if (pr < 0) {
|
||||
int interrupted = errno == EINTR;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue