summaryrefslogtreecommitdiff
path: root/src/ui/inputwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-08 10:19:22 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-08 10:22:36 +0200
commit592da516dc2eb4f4b9f3708481395073ca10d9f5 (patch)
treecc580ebcfd302218da59b2629ef48ed2a98ce27f /src/ui/inputwidget.c
parent775f43a3197bb402a029448a71db486ac8d68008 (diff)
Cleanup
Function naming convention is: {method}_{class}() Ran clang-format on the changes.
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r--src/ui/inputwidget.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index 45214d60..b51bd3ef 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -540,26 +540,24 @@ static iBool copy_InputWidget_(iInputWidget *d, iBool doCut) {
540 return iFalse; 540 return iFalse;
541} 541}
542 542
543static void process_Paste_(iInputWidget *d) { 543static void paste_InputWidget_(iInputWidget *d) {
544 if (SDL_HasClipboardText()) { 544 if (SDL_HasClipboardText()) {
545 pushUndo_InputWidget_(d); 545 pushUndo_InputWidget_(d);
546 deleteMarked_InputWidget_(d); 546 deleteMarked_InputWidget_(d);
547 char *text = SDL_GetClipboardText(); 547 char * text = SDL_GetClipboardText();
548 iString *paste = collect_String(newCStr_String(text)); 548 iString *paste = collect_String(newCStr_String(text));
549 /* Url decoding. */ 549 /* Url decoding. */
550 if (d->inFlags & isUrl_InputWidgetFlag) { 550 if (d->inFlags & isUrl_InputWidgetFlag) {
551 if (prefs_App()->decodeUserVisibleURLs) { 551 if (prefs_App()->decodeUserVisibleURLs) {
552 paste = collect_String(urlDecode_String(paste)); 552 paste = collect_String(urlDecode_String(paste));
553 } 553 }
554 else { 554 else {
555 urlEncodePath_String(paste); 555 urlEncodePath_String(paste);
556 } 556 }
557 } 557 }
558 SDL_free(text); 558 SDL_free(text);
559 iConstForEach(String, i, paste) { 559 iConstForEach(String, i, paste) { insertChar_InputWidget_(d, i.value); }
560 insertChar_InputWidget_(d, i.value); 560 contentsWereChanged_InputWidget_(d);
561 }
562 contentsWereChanged_InputWidget_(d);
563 } 561 }
564} 562}
565 563
@@ -629,7 +627,7 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {
629 copy_InputWidget_(d, key == 'x'); 627 copy_InputWidget_(d, key == 'x');
630 return iTrue; 628 return iTrue;
631 case 'v': 629 case 'v':
632 process_Paste_(d); 630 paste_InputWidget_(d);
633 return iTrue; 631 return iTrue;
634 case 'z': 632 case 'z':
635 if (popUndo_InputWidget_(d)) { 633 if (popUndo_InputWidget_(d)) {
@@ -643,7 +641,7 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {
643 switch (key) { 641 switch (key) {
644 case SDLK_INSERT: 642 case SDLK_INSERT:
645 if (mods == KMOD_SHIFT) { 643 if (mods == KMOD_SHIFT) {
646 process_Paste_(d); 644 paste_InputWidget_(d);
647 } 645 }
648 return iTrue; 646 return iTrue;
649 case SDLK_RETURN: 647 case SDLK_RETURN: