From 2b1ff130f00291dd0e0ed25411afb876ce5d88ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sat, 21 May 2022 13:25:13 -0300 Subject: [PATCH] ecode: Minor improvements. --- src/tools/ecode/ecode.cpp | 4 +++- src/tools/ecode/globalsearchcontroller.cpp | 11 +++++++++++ src/tools/ecode/projectsearch.cpp | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index a4c6a20de..376be8d51 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -2755,9 +2755,11 @@ void App::init( std::string file, const Float& pidelDensity, const std::string& TextInput#search_replace, TextInput#locate_find, TextInput#global_search_find, - TextInput.small_input { + TextInput.small_input, + .search_str { padding-top: 0; padding-bottom: 0; + font-family: monospace; } #search_bar, #global_search_bar, diff --git a/src/tools/ecode/globalsearchcontroller.cpp b/src/tools/ecode/globalsearchcontroller.cpp index 12ef61956..604b7f4d4 100644 --- a/src/tools/ecode/globalsearchcontroller.cpp +++ b/src/tools/ecode/globalsearchcontroller.cpp @@ -96,6 +96,13 @@ void GlobalSearchController::initGlobalSearchBar( UIGlobalSearchBar* globalSearc mGlobalSearchTreeReplace == mGlobalSearchTree, true ); } } ); + mGlobalSearchBarLayout->addCommand( "search-set-string", [&] { + auto listBox = mGlobalSearchHistoryList->getListBox(); + mGlobalSearchInput->setText( + mGlobalSearchHistory[mGlobalSearchHistory.size() - 1 - listBox->getItemSelectedIndex()] + .first ); + ; + } ); mGlobalSearchBarLayout->addCommand( "close-global-searchbar", [&] { hideGlobalSearchBar(); if ( mEditorSplitter->getCurEditor() ) @@ -165,6 +172,7 @@ void GlobalSearchController::initGlobalSearchBar( UIGlobalSearchBar* globalSearc + @@ -180,6 +188,8 @@ void GlobalSearchController::initGlobalSearchBar( UIGlobalSearchBar* globalSearc mUISceneNode->getRoot() ) ->asType(); UIPushButton* searchAgainBtn = mGlobalSearchLayout->find( "global_search_again" ); + UIPushButton* searchSetSearch = + mGlobalSearchLayout->find( "global_search_set_search" ); UITextInput* replaceInput = mGlobalSearchLayout->find( "global_search_replace_input" ); UIPushButton* replaceButton = @@ -189,6 +199,7 @@ void GlobalSearchController::initGlobalSearchBar( UIGlobalSearchBar* globalSearc UIPushButton* searchCollapseButton = mGlobalSearchLayout->find( "global_search_collapse" ); addClickListener( searchAgainBtn, "search-again" ); + addClickListener( searchSetSearch, "search-set-string" ); addClickListener( replaceButton, "replace-in-files" ); addClickListener( searchExpandButton, "expand-all" ); addClickListener( searchCollapseButton, "collapse-all" ); diff --git a/src/tools/ecode/projectsearch.cpp b/src/tools/ecode/projectsearch.cpp index 53bbd0c4c..58ad9fb23 100644 --- a/src/tools/ecode/projectsearch.cpp +++ b/src/tools/ecode/projectsearch.cpp @@ -106,7 +106,7 @@ searchInFileLuaPattern( const std::string& file, const std::string& text, const continue; } size_t relCol; - totNl += countNewLines( fileText, searchRes, end ); + totNl += countNewLines( fileText, searchRes, start ); String str( textLine( caseSensitive ? fileText : fileTextOriginal, start, relCol ) ); int len = end - start; res.push_back(