Repository navigation
add TUI widgets, improve TUI programs and TUI lib #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # Общие виджеты и командерное управление | ||
|
|
||
| ## Библиотека | ||
|
|
||
| `ktuilib` предоставляет окна с clipping, вложенные модальные окна, меню, | ||
| списки с прокруткой, полосы прогресса и следующие переиспользуемые виджеты: | ||
|
|
||
| - `tui_input`: ограниченный NUL-terminated буфер, курсор, Home/End, | ||
| Left/Right, Backspace/Delete, вставка в середину и горизонтальная прокрутка; | ||
| - `tui_button`: обычное, сфокусированное и disabled-состояние; | ||
| - `tui_checkbox`, `tui_radio`: отображение состояния; | ||
| - `tui_toggle_key`, `tui_focus_key`: Space для переключения и Tab для обхода; | ||
| - `tui_list_draw`: общий список с маркером выбора и scrollbar. | ||
|
|
||
| Поле ввода не владеет буфером; capacity включает завершающий NUL. Перед | ||
| отрисовкой буфер должен быть корректной строкой. Radio рисует один элемент, | ||
| а взаимоисключение элементов группы контролирует приложение. | ||
| В KTUI клавиша H открывает интерактивный пример виджетов. | ||
| Общие prompt/confirm/message используют новые поля и кнопки. | ||
|
|
||
| ## Роли тем | ||
|
|
||
| Старый формат `XX=YY` и все прежние атрибуты сохраняются. Новые роли: | ||
|
|
||
| | Ключ | Назначение | | ||
| |---|---| | ||
| | 73 | Поле ввода | | ||
| | 74 | Кнопка | | ||
| | 75 | Фокус | | ||
| | 76 | Недоступный элемент | | ||
| | 77 / 78 / 79 | Ошибка / предупреждение / успех | | ||
| | 7A / 7B / 7C | Маркировка файлов / каталог / рамка | | ||
| | 7D / 7E / 7F / 80 | Комментарий / строка / число / ключевое слово | | ||
| | 81 / 82 | Visual-выделение / статус (доступная роль для приложений) | | ||
|
|
||
| Отсутствующие роли наследуют соответствующие старые цвета, а не отображаются | ||
| как VGA-атрибут собственного номера. KTTE позволяет редактировать эти роли | ||
| в прокручиваемом простом режиме и сохраняет все 256 отображений. | ||
| Не каждый старый жёстко заданный цвет приложений заменён семантической ролью. | ||
|
|
||
| ## KC | ||
|
|
||
| F1 справка, F2 сведения, F3 просмотр, F4 редактор, F5 копирование, | ||
| F6 перемещение, F7 mkdir, F8 удаление, F9 настройки, F10 выход. | ||
| Прежние буквенные команды работают. Tab меняет панель, T создаёт вкладку, | ||
| `[`/`]` переключают, X закрывает вкладку, `/` открывает каталог. | ||
|
|
||
| Insert или Space маркируют запись и переходят к следующей; `+` маркирует все, | ||
| `-` снимает маркировку. Родитель `..` не маркируется. C/M/D и F5/F6/F8 | ||
| применяются к отмеченным записям, а при отсутствии отметок — к текущей. | ||
| Перед групповой операцией требуется подтверждение. При частичном успехе | ||
| показывается отдельное сообщение; отката нет. Маркировка привязана к именам, | ||
| при смене каталога сбрасывается. | ||
|
|
||
| Это не полная копия MC: нет рекурсивного копирования/удаления, перезаписи | ||
| существующих целей, VFS архивов и удалённых ФС. Действуют ограничения FAT12 | ||
| ASCII 8.3, до 256 записей в панели и четыре вкладки. | ||
|
|
||
| ## Vik и kuned | ||
|
|
||
| Vik не использует Ctrl+Q и Ctrl+S. Выход: `:q`, `:q!`, сохранение: `:w`, | ||
| `:w PATH`, `:wq`. Esc возвращает из insert в normal, из visual — снимает выбор. | ||
|
|
||
| Дополнительно к прежним командам: | ||
|
|
||
| - `h/j/k/l`, `w/b/e`, `0/^/$`, `G`, `числоG`, числовые повторы движений; | ||
| - `d/c/y` + движение, `dd/cc/yy`, числовые повторы операторов (`2dw`, `d2w`); | ||
| - `D/C`, `x`, `p/P`, `v/V` с `d/c/y`; | ||
| - `"a`–`"z` выбирают регистр следующего yank/delete/paste; | ||
| - `u` и Ctrl+R переключают undo/redo (восемь снимков). | ||
|
|
||
| Именованные регистры независимы; совместимость со всеми специальными | ||
| регистрами Vim не заявляется. Insert пока сохраняет снимок на каждый символ, | ||
| а не на всю сессию вставки. Нет regex, macros, dot-repeat, text objects, | ||
| split windows, plugins, полной Ex-грамматики и полной семантики курсора Vim. | ||
| Редактор ограничен 64 КиБ. Read-only запрещает изменение через операторы. | ||
|
|
||
| Оба редактора выбирают подсветку по расширению: C/H/CPP/JS/TS, ASM/S/INC, | ||
| SH/PY, CFG/INI/THM; остальные файлы — обычный текст. Лексер различает строки, | ||
| числа, базовые ключевые слова и комментарии соответствующего семейства, | ||
| включая многострочные C-комментарии. Это не полноценный парсер языка. | ||
|
|
||
| KPROCM/KDISKMAN/KTUI поддерживают F1 и F10; KDISKMAN показывает состояние | ||
| тома через роли успеха/ошибки. Изменены клавиатурные события: пересобирайте | ||
| ядро и системные ELF вместе. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marks are lost when the user switches between tabs that show different directories.
loaded_directoryis stored once perpanel, but marks are stored pertab. The[and]handlers changep->active. On the nextrefresh,current->directorydiffers fromp->loaded_directory. The code then clearsmarksof the tab that was just activated and overwritesloaded_directory. Switching away and back therefore silently discards the marks in both tabs. ATnew tab also copies the marks into the new tab.The marks should be cleared only when that tab's own directory changes. Track the loaded directory per tab.
Move
loaded_directoryintotab:Proposed fix
typedef struct { char directory[256]; char previous[256]; + char loaded_directory[256]; u32 selected, top; char marked[ENTRIES][13]; u32 marks; } tab; @@ - char loaded_directory[256]; } panel; @@ - if (!same(p->loaded_directory, current->directory)) { + if (!same(current->loaded_directory, current->directory)) { current->marks = 0; - tui_copy(p->loaded_directory, current->directory, 256); + tui_copy(current->loaded_directory, current->directory, 256); }Also applies to: 17-17