=> 628c37554b80ba8b045aee11aee8de771c083c15
[1mdiff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c[m [1mindex 165c4453..6f4c3a6b 100644[m [1m--- a/src/ui/inputwidget.c[m [1m+++ b/src/ui/inputwidget.c[m [36m@@ -24,6 +24,10 @@[m [mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m The primary source of complexity is the handling of wrapped text content[m in the custom text editor. */[m [m [32m+[m[32m/* TODO: Refactor this so that the native text input widget has a common base[m [32m+[m[32m class with the fully-custom input widget. Currently this implementation is[m [32m+[m[32m too convoluted, with both variants intermingled. */[m [32m+[m #include "inputwidget.h"[m #include "command.h"[m #include "paint.h"[m [36m@@ -1472,11 +1476,11 @@[m [mstatic iBool moveCursorByLine_InputWidget_(iInputWidget *d, int dir, int horiz)[m }[m iWrapText wt = wrap_InputWidget_(d, d->cursor.y);[m if (isEqual_I2(relCoord, zero_I2())) {[m [31m- /* This is simple enough to figure out. */[m [32m+[m[32m /* (0, 0) disables the hit test, but this is trivial to figure out. */[m wt.hitChar_out = wt.text.start; [m }[m else {[m [31m- wt.hitPoint = addY_I2(relCoord, 1 * aspect_UI); /* never (0, 0) because that disables the hit test */[m [32m+[m[32m wt.hitPoint = addY_I2(relCoord, 1 * aspect_UI);[m[41m [m measure_WrapText(&wt, d->font);[m }[m if (wt.hitChar_out) {[m [36m@@ -2214,6 +2218,20 @@[m [mstatic void overflowScrollToKeepVisible_InputWidget_(iAny *widget) {[m }[m }[m [m [32m+[m[32mstatic iBool isSelectAllEvent_InputWidget_(const SDL_KeyboardEvent *ev) {[m [32m+[m[32m /* Note: If this were a binding, it would have to conditional on an InputWidget being focused. */[m [32m+[m[32m if (ev->state != SDL_PRESSED) {[m [32m+[m[32m return iFalse;[m [32m+[m[32m }[m [32m+[m[32m const int key = ev->keysym.sym;[m [32m+[m[32m const int mods = keyMods_Sym(ev->keysym.mod);[m [32m+[m[32m#if defined (iPlatformTerminal)[m [32m+[m[32m return key == SDLK_a && mods == KMOD_ALT;[m [32m+[m[32m#else[m [32m+[m[32m return key == SDLK_a && mods == KMOD_PRIMARY;[m [32m+[m[32m#endif[m[41m [m [32m+[m[32m}[m [32m+[m static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {[m iWidget *w = as_Widget(d);[m /* Resize according to width immediately. */[m [36m@@ -2442,7 +2460,16 @@[m [mstatic iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {[m }[m # endif[m d->prevCursor = d->cursor;[m [31m-#endif[m [32m+[m[32m if (isSelectAllEvent_InputWidget_(&ev->key)) {[m [32m+[m[32m selectAll_InputWidget(d);[m [32m+[m[32m d->mark.start = 0;[m [32m+[m[32m d->mark.end = cursorToIndex_InputWidget_(d, curMax);[m [32m+[m[32m d->cursor = curMax;[m [32m+[m[32m showCursor_InputWidget_(d);[m [32m+[m[32m refresh_Widget(w);[m [32m+[m[32m return iTrue;[m[41m [m [32m+[m[32m }[m [32m+[m[32m#endif /* !LAGRANGE_USE_SYSTEM_TEXT_INPUT */[m switch (key) {[m case SDLK_RETURN:[m case SDLK_KP_ENTER:[m [36m@@ -2565,28 +2592,21 @@[m [mstatic iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {[m refresh_Widget(w);[m return iTrue;[m case SDLK_a:[m [31m-#if !defined (iPlatformTerminal) /* Emacs-style ^A/^E in the terminal */[m [31m- if (mods == KMOD_PRIMARY) {[m [31m-#else[m [31m- if (mods == KMOD_ALT /* meta */) {[m [31m-#endif[m [31m- selectAll_InputWidget(d);[m [31m- d->mark.start = 0;[m [31m- d->mark.end = cursorToIndex_InputWidget_(d, curMax);[m [31m- d->cursor = curMax;[m [31m- showCursor_InputWidget_(d);[m [31m- refresh_Widget(w);[m [31m- return iTrue;[m [31m- }[m [31m-# if defined (iPlatformApple)[m [31m- /* fall through for Emacs-style Home/End */[m case SDLK_e:[m if (mods == KMOD_CTRL || mods == (KMOD_CTRL | KMOD_SHIFT)) {[m [32m+[m[32m# if defined (iPlatformTerminal)[m [32m+[m[32m /* Move to the start/end of the current wrapped line. */[m [32m+[m[32m moveCursorByLine_InputWidget_(d, 0, key == 'a' ? -1 : +1);[m [32m+[m[32m refresh_Widget(w);[m [32m+[m[32m return iTrue;[m [32m+[m[32m# endif[m [32m+[m[32m# if defined (iPlatformApple)[m [32m+[m[32m /* Move to the start/end of the current paragraph. */[m setCursor_InputWidget(d, key == 'a' ? lineFirst : lineLast);[m refresh_Widget(w);[m return iTrue;[m [32m+[m[32m# endif[m }[m [31m-# endif[m break;[m case SDLK_LEFT:[m case SDLK_RIGHT: {[m [36m@@ -2636,7 +2656,7 @@[m [mstatic iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {[m }[m refresh_Widget(d);[m return iTrue;[m [31m-#endif[m [32m+[m[32m#endif /* !LAGRANGE_USE_SYSTEM_TEXT_INPUT */[m }[m if (mods & (KMOD_GUI | KMOD_CTRL)) {[m return iFalse;[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).