Skip to content

Commit

Permalink
Issue 1063: change default guicursor behavior
Browse files Browse the repository at this point in the history
Currently, when no guicursor value is provided (styling is disabled), we
use some default values: block, ver25, or hor25 based on mode.

The TUI does not behave the same way, it uses block mode for all cases
when guicursor is empty.

This change removes the cursor defaults, and applies block mode to all
cases where guicursor is empty.
  • Loading branch information
jgehrig committed May 3, 2023
1 parent 2b4cb87 commit 4a911fa
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions src/gui/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ void Shell::handleRedraw(const QByteArray& name, const QVariantList& opargs)
} else if (name == "popupmenu_hide") {
m_pum.hide();
} else if (name == "mode_info_set") {
qDebug() << "mode_info_set";
qDebug() << " " << opargs;
handleModeInfoSet(opargs);
} else if (name == "flush") {
// Do Nothing, a notification that nvim is done redrawing.
Expand Down Expand Up @@ -688,25 +690,13 @@ void Shell::handleModeChange(const QVariantList& opargs)
return;
}

const QString mode{ m_nvim->decode(opargs.at(0).toByteArray()) };
//const QString mode{ m_nvim->decode(opargs.at(0).toByteArray()) };
const uint64_t modeIndex{ opargs.at(1).toULongLong() };

if (!m_cursor.IsStyleEnabled()) {
if (mode == "insert") {
m_cursor.SetColor({});
m_cursor.SetStyle(Cursor::Shape::Vertical, 25);
m_cursor.SetTimer(0, 0, 0);
}
else if (mode == "replace") {
m_cursor.SetColor({});
m_cursor.SetStyle(Cursor::Shape::Horizontal, 20);
m_cursor.SetTimer(0, 0, 0);
}
else {
m_cursor.SetColor({});
m_cursor.SetStyle(Cursor::Shape::Block, 100);
m_cursor.SetTimer(0, 0, 0);
}
m_cursor.SetColor({});
m_cursor.SetStyle(Cursor::Shape::Block, 100);
m_cursor.SetTimer(0, 0, 0);

update(neovimCursorRect());
return;
Expand Down Expand Up @@ -786,6 +776,8 @@ void Shell::handleModeInfoSet(const QVariantList& opargs)
const bool cursor_style_enabled{ opargs.at(0).toBool() };
const QVariantList mode_info = opargs.at(1).toList();

qDebug() << " cursor_style_enabled:" << cursor_style_enabled;

m_cursor.SetIsStyleEnabled(cursor_style_enabled);
m_modeInfo = mode_info;
}
Expand Down

0 comments on commit 4a911fa

Please sign in to comment.