diff --git a/bin/assets/i18n/de.xml b/bin/assets/i18n/de.xml
index 28909000c..482edba27 100644
--- a/bin/assets/i18n/de.xml
+++ b/bin/assets/i18n/de.xml
@@ -37,7 +37,6 @@ Diese Operation kann nicht rückgängig gemacht werden!
KI-Unterhaltungen
Womit kann ich helfen?
Unterhaltung umbenennen
- Blinkende Eingabemarke erlauben
Jegliche http(s)/URLs
Jeglicher Name...
Programmrückgabe
@@ -321,7 +320,6 @@ ecode versucht, externes Terminal zu öffnen.
Voriges finden
Suchen/Ersetzen
Suchen:
- Eingabemarke aufblinken
Ordner/Projekteinstellungen
Ordner/Projekteinstellungen
Blockfaltungsaktualisierungsfrequenz
diff --git a/bin/assets/i18n/en.xml b/bin/assets/i18n/en.xml
index 3d250d674..4edfdbe2e 100644
--- a/bin/assets/i18n/en.xml
+++ b/bin/assets/i18n/en.xml
@@ -22,7 +22,6 @@ This operation cannot be reverted!
AI Conversations History
What can I help with?
Rename Conversation
- Allow Flashing Cursor
Any https or http URL
Any name...
App Output
@@ -306,7 +305,6 @@ ecode will try to open an external terminal.
Find Prev
Find Replace
Find:
- Flash Cursor
Folder/Project Settings
Folder/Project Settings
Folds Refresh Frequency
diff --git a/include/eepp/ui/uicodeeditor.hpp b/include/eepp/ui/uicodeeditor.hpp
index a7795b9fa..6e8f5b2c0 100644
--- a/include/eepp/ui/uicodeeditor.hpp
+++ b/include/eepp/ui/uicodeeditor.hpp
@@ -931,8 +931,6 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client {
String::HashType mTagFoldRange{ 0 };
Uint32 mTabIndentCharacter{ 187 /*'»'*/ };
CharacterAlignment mTabIndentAlignment{ CharacterAlignment::Center };
- Uint32 mModDownCount{ 0 };
- Clock mModDownClock;
UICodeEditor( const std::string& elementTag, const bool& autoRegisterBaseCommands = true,
const bool& autoRegisterBaseKeybindings = true );
@@ -1139,8 +1137,6 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client {
bool isNotMonospace() const;
- void flashCursor();
-
void setCodeEditorFlags( std::string flags, bool enable );
std::string getCodeEditorFlags( bool enabled ) const;
diff --git a/include/eepp/ui/uitabwidget.hpp b/include/eepp/ui/uitabwidget.hpp
index a7e9cd56f..08eb40891 100644
--- a/include/eepp/ui/uitabwidget.hpp
+++ b/include/eepp/ui/uitabwidget.hpp
@@ -244,10 +244,12 @@ class EE_API UITabWidget : public UIWidget {
bool mDroppableHoveringColorWasSet{ false };
bool mEnabledCreateContextMenu{ false };
bool mEnableTabSwitcher{ false };
+ bool mTabSwitcherRunning{ false };
Float mTabVerticalDragResistance;
Color mDroppableHoveringColor{ Color::Transparent };
FocusTabBehavior mFocusTabBehavior{ FocusTabBehavior::Closest };
std::deque mFocusHistory;
+ std::deque mFocusHistoryFreezed;
UIPopUpMenu* mCurrentMenu{ nullptr };
SplitFunctionCb mSplitFn;
Float mSplitEdgePercent{ 0.1 };
@@ -306,7 +308,11 @@ class EE_API UITabWidget : public UIWidget {
void createTabSwitcher( const std::vector& tabSwitcherMetaTrigger,
bool fromPrev = false );
+ void enableTabSwitcher( const std::vector& tabSwitcherMetaTrigger );
+
Uint32 getTabSelectedFocusHistoryIndex() const;
+
+ Uint32 getTabSelectedFocusHistoryFreezedIndex() const;
};
}} // namespace EE::UI
diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp
index 6b9763c03..fcbcc8468 100644
--- a/src/eepp/ui/uicodeeditor.cpp
+++ b/src/eepp/ui/uicodeeditor.cpp
@@ -1138,28 +1138,6 @@ Uint32 UICodeEditor::onTextEditing( const TextEditingEvent& event ) {
return 1;
}
-void UICodeEditor::flashCursor() {
- Vector2f screenStart( getScreenStart() );
- Vector2f start( screenStart.x + getGutterWidth(), screenStart.y + getPluginsTopSpace() );
- Vector2f startScroll( start - mScroll );
- auto offset = getTextPositionOffset( mDoc->getSelection().start(), getLineHeight() );
- Vector2f cursorPos( startScroll.x + offset.x - getFontHeight() * 0.5f,
- startScroll.y + offset.y );
- UIWidget* widget = UIWidget::New();
- widget->setBorderColor( Color( mCaretColor ).blendAlpha( 100 ).blendAlpha( mAlpha ) );
- widget->setPixelsPosition( cursorPos.floor() );
- widget->setBorderWidth( PixelDensity::dpToPx( 2 ) );
- widget->setPixelsSize( Sizef( getFontHeight(), getFontHeight() ) );
- widget->setEnabled( false );
-
- Float scale = eemax( getUISceneNode()->getPixelsSize().getWidth() / getFontHeight(),
- getUISceneNode()->getPixelsSize().getHeight() / getFontHeight() );
-
- widget->runAction( Actions::Sequence::New(
- Actions::Scale::New( { scale, scale }, { 1, 1 }, Milliseconds( 250 ), Ease::Linear ),
- Actions::Close::New() ) );
-}
-
void UICodeEditor::setCodeEditorFlags( std::string flags, bool enable ) {
String::toLowerInPlace( flags );
String::readBySeparator(
@@ -1302,22 +1280,6 @@ Uint32 UICodeEditor::onKeyDown( const KeyEvent& event ) {
}
Uint32 UICodeEditor::onKeyUp( const KeyEvent& event ) {
- if ( isEnabledFlashCursor() && event.getSanitizedMod() == KeyMod::getDefaultModifier() ) {
- if ( mModDownCount == 0 )
- mModDownClock.restart();
-
- if ( mModDownClock.getElapsedTime() < Milliseconds( 250 ) ) {
- mModDownCount++;
- if ( mModDownCount == 5 ) {
- mModDownCount = 0;
- flashCursor();
- }
- } else
- mModDownCount = 0;
-
- mModDownClock.restart();
- }
-
mLastActivity.restart();
for ( auto& plugin : mPlugins )
if ( plugin->onKeyUp( this, event ) )
@@ -4428,7 +4390,6 @@ void UICodeEditor::registerCommands() {
mDoc->setCommand( "copy-file-path-and-position", [this] { copyFilePath( true ); } );
mDoc->setCommand( "find-replace", [this] { showFindReplace(); } );
mDoc->setCommand( "open-context-menu", [this] { createContextMenu(); } );
- mDoc->setCommand( "flash-cursor", [this] { flashCursor(); } );
mUnlockedCmd.insert( { "copy", "select-all", "open-containing-folder",
"copy-containing-folder-path", "copy-file-path",
"copy-file-path-and-position", "open-context-menu", "find-replace" } );
diff --git a/src/eepp/ui/uitabwidget.cpp b/src/eepp/ui/uitabwidget.cpp
index afcca3f6a..cf0c63c2f 100644
--- a/src/eepp/ui/uitabwidget.cpp
+++ b/src/eepp/ui/uitabwidget.cpp
@@ -1329,13 +1329,29 @@ void UITabWidget::createTabSwitcher( const std::vector& tabSwitcherMeta
}
}
+void UITabWidget::enableTabSwitcher( const std::vector& tabSwitcherMetaTrigger ) {
+ if ( !tabSwitcherMetaTrigger.empty() && !mTabSwitcherRunning ) {
+ mTabSwitcherRunning = true;
+ mFocusHistoryFreezed = mFocusHistory;
+ removeEventsOfType( Event::KeyUp );
+ on( Event::KeyUp, [this, tabSwitcherMetaTrigger]( const Event* event ) {
+ auto keyCode = event->asKeyEvent()->getKeyCode();
+ if ( std::find( tabSwitcherMetaTrigger.begin(), tabSwitcherMetaTrigger.end(),
+ keyCode ) != tabSwitcherMetaTrigger.end() ) {
+ removeEventListener( event->getCallbackId() );
+ mTabSwitcherRunning = false;
+ }
+ } );
+ }
+}
+
void UITabWidget::focusNextTab( const std::vector& tabSwitcherMetaTrigger ) {
if ( mEnableTabSwitcher ) {
- bool wasVisible = mTabSwitcher && mTabSwitcher->isVisible();
+ bool wasEnabled = mTabSwitcher && mTabSwitcher->isVisible();
createTabSwitcher( tabSwitcherMetaTrigger );
- if ( wasVisible && !mTabSwitcher->getSelection().isEmpty() ) {
+ if ( wasEnabled && !mTabSwitcher->getSelection().isEmpty() ) {
Int32 index = ( mTabSwitcher->getSelection().first().row() + 1 ) %
mTabSwitcher->getModel()->rowCount();
mTabSwitcher->setSelection( mTabSwitcher->getModel()->index( index, 0 ) );
@@ -1347,6 +1363,8 @@ void UITabWidget::focusNextTab( const std::vector& tabSwitcherMetaTrigg
if ( getTabCount() <= 1 )
return;
+ enableTabSwitcher( tabSwitcherMetaTrigger );
+
switch ( mTabJumpMode ) {
case TabJumpMode::Linear: {
Int32 index = ( getTabSelectedIndex() + 1 ) % getTabCount();
@@ -1354,9 +1372,14 @@ void UITabWidget::focusNextTab( const std::vector& tabSwitcherMetaTrigg
break;
}
case TabJumpMode::Chronological: {
- Int32 newTabIndex = (Int32)getTabSelectedFocusHistoryIndex() - 1;
- Int32 index = newTabIndex < 0 ? mFocusHistory.size() - newTabIndex : newTabIndex;
- setTabSelected( mFocusHistory[index] );
+ if ( mTabSwitcherRunning ) {
+ Int32 index =
+ ( getTabSelectedFocusHistoryFreezedIndex() + 1 ) % mFocusHistory.size();
+ setTabSelected( mFocusHistoryFreezed[index] );
+ } else {
+ Int32 index = ( getTabSelectedFocusHistoryIndex() + 1 ) % mFocusHistory.size();
+ setTabSelected( mFocusHistory[index] );
+ }
break;
}
}
@@ -1380,6 +1403,8 @@ void UITabWidget::focusPreviousTab( const std::vector& tabSwitcherMetaT
if ( getTabCount() <= 1 )
return;
+ enableTabSwitcher( tabSwitcherMetaTrigger );
+
switch ( mTabJumpMode ) {
case TabJumpMode::Linear: {
Int32 newTabIndex = (Int32)getTabSelectedIndex() - 1;
@@ -1388,8 +1413,16 @@ void UITabWidget::focusPreviousTab( const std::vector& tabSwitcherMetaT
break;
}
case TabJumpMode::Chronological: {
- Int32 index = ( getTabSelectedFocusHistoryIndex() + 1 ) % mFocusHistory.size();
- setTabSelected( mFocusHistory[index] );
+ if ( mTabSwitcherRunning ) {
+ Int32 newTabIndex = (Int32)getTabSelectedFocusHistoryFreezedIndex() - 1;
+ Int32 index =
+ newTabIndex < 0 ? mFocusHistoryFreezed.size() + newTabIndex : newTabIndex;
+ setTabSelected( mFocusHistoryFreezed[index] );
+ } else {
+ Int32 newTabIndex = (Int32)getTabSelectedFocusHistoryIndex() - 1;
+ Int32 index = newTabIndex < 0 ? mFocusHistory.size() + newTabIndex : newTabIndex;
+ setTabSelected( mFocusHistory[index] );
+ }
break;
}
}
@@ -1400,4 +1433,9 @@ Uint32 UITabWidget::getTabSelectedFocusHistoryIndex() const {
return it != mFocusHistory.end() ? std::distance( mFocusHistory.begin(), it ) : 0;
}
+Uint32 UITabWidget::getTabSelectedFocusHistoryFreezedIndex() const {
+ auto it = std::find( mFocusHistoryFreezed.begin(), mFocusHistoryFreezed.end(), mTabSelected );
+ return it != mFocusHistoryFreezed.end() ? std::distance( mFocusHistoryFreezed.begin(), it ) : 0;
+}
+
}} // namespace EE::UI
diff --git a/src/tools/ecode/appconfig.cpp b/src/tools/ecode/appconfig.cpp
index bf640d0c4..150e94bea 100644
--- a/src/tools/ecode/appconfig.cpp
+++ b/src/tools/ecode/appconfig.cpp
@@ -190,7 +190,6 @@ void AppConfig::load( const std::string& confPath, std::string& keybindingsPath,
editor.tabIndentAlignment = characterAlignmentFromString(
ini.getValue( "editor", "tab_indent_alignment",
characterAlignmentToString( CharacterAlignment::Center ) ) );
- editor.flashCursor = ini.getValueB( "editor", "flash_cursor", false );
searchBarConfig.caseSensitive = ini.getValueB( "search_bar", "case_sensitive", false );
searchBarConfig.luaPattern = ini.getValueB( "search_bar", "lua_pattern", false );
@@ -344,7 +343,6 @@ void AppConfig::save( const std::vector& recentFiles,
ini.setValue( "editor", "tab_indent_character", editor.tabIndentCharacter );
ini.setValue( "editor", "tab_indent_alignment",
characterAlignmentToString( editor.tabIndentAlignment ) );
- ini.setValueB( "editor", "flash_cursor", editor.flashCursor );
ini.setValueB( "search_bar", "case_sensitive", searchBarConfig.caseSensitive );
ini.setValueB( "search_bar", "lua_pattern", searchBarConfig.luaPattern );
diff --git a/src/tools/ecode/appconfig.hpp b/src/tools/ecode/appconfig.hpp
index 0dc78ab50..91c88f49c 100644
--- a/src/tools/ecode/appconfig.hpp
+++ b/src/tools/ecode/appconfig.hpp
@@ -85,7 +85,6 @@ struct CodeEditorConfig {
bool autoReloadOnDiskChange{ false };
bool codeFoldingEnabled{ true };
bool codeFoldingAlwaysVisible{ false };
- bool flashCursor{ false };
LineWrapMode wrapMode{ LineWrapMode::NoWrap };
LineWrapType wrapType{ LineWrapType::Viewport };
bool wrapKeepIndentation{ true };
diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp
index 0f8197f85..17c2dabd5 100644
--- a/src/tools/ecode/ecode.cpp
+++ b/src/tools/ecode/ecode.cpp
@@ -2375,7 +2375,6 @@ void App::onCodeEditorCreated( UICodeEditor* editor, TextDocument& doc ) {
editor->setLineWrapType( config.wrapType );
editor->setFoldDrawable( findIcon( "chevron-down", PixelDensity::dpToPxI( 12 ) ) );
editor->setFoldedDrawable( findIcon( "chevron-right", PixelDensity::dpToPxI( 12 ) ) );
- editor->setEnableFlashCursor( config.flashCursor );
editor->setTabStops( mConfig.doc.tabStops );
doc.setAutoCloseBrackets( !mConfig.editor.autoCloseBrackets.empty() );
diff --git a/src/tools/ecode/settingsmenu.cpp b/src/tools/ecode/settingsmenu.cpp
index 39cdc4d34..e6112b552 100644
--- a/src/tools/ecode/settingsmenu.cpp
+++ b/src/tools/ecode/settingsmenu.cpp
@@ -671,17 +671,6 @@ UIMenu* SettingsMenu::createDocumentMenu() {
"before exiting the program." ) )
->setId( "session_snapshot" );
- mGlobalMenu
- ->addCheckBox( i18n( "allow_flash_cursor", "Allow Flashing Cursor" ),
- mApp->getConfig().editor.flashCursor )
- ->setTooltipText( i18n(
- "allow_flash_cursor_desc",
- "When enabled, pressing the default modifier key 5 times within 1.5 seconds will\n"
- "trigger a visual effect that highlights the current cursor position. A large,\n"
- "transparent rectangle will briefly animate, shrinking down to the cursor, making it\n"
- "easier to locate when it's hard to see." ) )
- ->setId( "allow_flash_cursor" );
-
mGlobalMenu->addSeparator();
mGlobalMenu->add( i18n( "line_breaking_column", "Line Breaking Column" ) )
@@ -740,11 +729,6 @@ UIMenu* SettingsMenu::createDocumentMenu() {
mApp->getConfig().editor.autoReloadOnDiskChange = item->isActive();
} else if ( "session_snapshot" == id ) {
mApp->getConfig().workspace.sessionSnapshot = item->isActive();
- } else if ( "allow_flash_cursor" == id ) {
- mApp->getConfig().editor.flashCursor = item->isActive();
- mSplitter->forEachEditor( [this]( UICodeEditor* editor ) {
- editor->setEnableFlashCursor( mApp->getConfig().editor.flashCursor );
- } );
} else if ( "tab_stops" == id ) {
mApp->getConfig().doc.tabStops = item->isActive();
mSplitter->forEachEditor( [this]( UICodeEditor* editor ) {