Velocity/modes/insert.py

34 lines
679 B
Python
Raw Normal View History

2022-03-15 15:37:38 +00:00
from core import statusbar, cursor
2022-03-14 07:21:55 +00:00
2022-03-15 15:37:38 +00:00
def execute(data, key):
return data
2022-03-14 07:21:55 +00:00
2022-03-15 15:37:38 +00:00
def activate(stdscr, data):
2022-03-14 07:21:55 +00:00
# Refresh the status bar with a different colour for insert
2022-03-15 15:37:38 +00:00
data["statusbar_colors"] = [8, 12, 14, 2]
statusbar.refresh(stdscr, data)
2022-03-14 07:21:55 +00:00
2022-03-15 15:37:38 +00:00
# Refresh the status bar
statusbar.refresh(stdscr, data)
2022-03-14 07:21:55 +00:00
2022-03-15 15:37:38 +00:00
# Move the cursor
cursor.move(stdscr, data)
# Switch to a line cursor
cursor.cursor_mode("line")
# Wait for and capture a key press from the user
key = stdscr.getch()
# Exit insert mode
if key == 27:
data["mode"] = "normal"
2022-03-14 07:21:55 +00:00
return data
2022-03-15 15:37:38 +00:00
# Check keybindings
data = execute(data, key)
return data