rezonality / zep Goto Github PK
View Code? Open in Web Editor NEWZep - An embeddable editor, with optional support for using vim keystrokes.
License: Other
Zep - An embeddable editor, with optional support for using vim keystrokes.
License: Other
I've recently integrated Zep into my project PCSX-Redux, replacing ImGuiColorTextEdit out. While doing so, I've done numerous little fixes and changes to Zep. I could create one issue / pull request per change I've done, but I'd like to avoid bombarding you with issues and PRs. But if you'd rather me doing so, please let me know and I'll gladly extract my changes in individual Pull Requests / issues.
My current list of changes are in https://github.com/nicolasnoble/zep/commits/40ff9f8c0fd0a159249c4f9d6e0ebcdee81dce1e, and here's a small list of issues / enhancements I've done:
The current ImGui input code assumes:
As a result, when using GLFW as the backend, typing the key a
on the keyboard (which is ascii 0x41 for glfw) will result in sending a function key instead:
zep/include/zep/imgui/editor_imgui.h
Line 26 in 435a218
I've created my own ZepEditor_imgui class, but my opinion is that the code should probably offer one Editor class per possible backend, like SDL, GLFW, etc.
(additionally, this new code uses ImGui::IsWindowFocused
to discard keyboard input that aren't directed towards the Zep widget)
The syntax.cpp file references lua keywords, but doesn't register any parser for it. The Lua syntax is significantly different from base C that it wouldn't work properly anyway, so I wrote a Lua parser that seems somewhat correct, or at least, good enough:
The current code assumes a single DPI scale, that never changes. In reality, this doesn't work, because users may change DPI on their current screen, or even have multiple monitors, all with different DPIs. As a result, DPI-aware code needs to be able to react to DPI change events. This is in essence what I've done here: nicolasnoble@97b4365
The code probably should use a signal to be broadcasted, in order to fully invalidate fonts and other painting, but I wasn't sure.
This is likely an API breaking change in its current state, due to the DPI scale being removed from the constructor.
(additionally, there is a dead, never used variable here:)
Line 445 in 435a218
The current code has a DisplayMode
enum that's never assigned to any value:
Line 252 in 435a218
As a result, this check is always true, regardless of the editor mode:
Line 1028 in 435a218
I've fixed this by using a new virtual on the mode: nicolasnoble@249dafe
More specifically, this part of the template:
Line 152 in 435a218
rhs.buffer
where rhs
is but a size integral.
Fix: nicolasnoble@a38f2f7
All the paste commands use the "
register for the slice of text to insert, but only registers *
and +
are assigned from the system's clipboard. Fix: nicolasnoble@68fb6ad
I've overhauled a bit the base syntax parser to handle numbers and comments a bit better. I'm still not totally happy with it, but I think it's a general improvement over the base code. The new file is at https://github.com/nicolasnoble/zep/blob/main/src/syntax.cpp
I have no idea how this fares on the Lisp mode however.
As a simple Quality of Life, I've added a mouse cursor and the ability to move the keyboard cursor to it: nicolasnoble@fe2a6a4
The feature is probably awkward as it doesn't actually send a command to move the cursor, which doesn't necessarily update the buffer status properly. Also affects all modes, not just standard. Mouse dragging to select would be a plus.
I think I'd rather move this to commands, using a new encoding for mouse events, similar to the <C-v>
pattern.
This feels a lot more natural than only having Ctrl-x working: nicolasnoble@03b1598
This also feels a lot more natural: nicolasnoble@40ff9f8
Describe the bug
Range marks should move around when the user edits text before/after/inside.
To Reproduce
:ZTestMarkers
Insert text before or after.
Expected behavior
Mark should stay where it is.
It seems it should be easier to integrate this great editor into an ImGUI project.
There is https://github.com/cmaughan/imgui/blob/b562cfeb14060a6b3b0c8189c3e16ea1ffa01070/imgui_demo.cpp#L219 Which is a much more simple integration example then the imgui demo. However it is outdated as ZepEditor expects more arguments for example.
There is a define ZEP_SINGLE_HEADER_BUILD which is there for convenience I guess. However it requires a config_app.h (single line file on my system?). Could be very handy to use without building a lib first.
The provided ImGui demo has quite some dependencies which (I'm not sure) are not really needed.
From what I read in the code the imgui demo uses freetype font rendering, I guess that's optional?
Perhaps the example can be updated as it seems more straightforward?
Describe the bug
src/line_widgets.cpp not compiled in single header mode.
linker throws errors
To Reproduce
Steps to reproduce the behavior:
make cpp file with and includes correct
#include <imgui.h>
#define ZEP_SINGLE_HEADER_BUILD
#include <zep.h>
compile
Expected behavior
add #include "../src/line_widgets.cpp" to zep.h
and it links just fine
Desktop (please complete the following information):
Additional context
Haven't tried using it yet, just getting it integrated atm
Is your feature request related to a problem? Please describe.
When the font changes, horizontal character spacing is not recomputed because m_charCacheDirty
is never set to true
again. Vertical spacing and about everything else seems OK.
Describe the solution you'd like
Maybe just a method in ZepWindow
that sets m_charCacheDirty
to true
?
Additional context
Initial rendering in ImGui:
After loading a larger or a smaller font:
Describe the solution you'd like
Want to support tabs natively and not convert them to spaces
Additional context
This is a feature request. It needs to be evaluated for time.
Describe the bug
It should not be necessary to use SDL to build the IMGUI component.
To Reproduce
Build without SDL
Expected behavior
No compile issues
Is your feature request related to a problem? Please describe.
Unenlightened users will probably need a vertical scroll bar.
Describe the solution you'd like
Add a scroller, and maybe a horizontal one for unwrapped modes
Describe alternatives you've considered
In Vim, users mostly move using keyboard. But a scrollbar is useful.
Additional context
It's not so easy to add a native scrollbar, so a drawn one will have to be added.
Is your feature request related to a problem? Please describe.
Need the ability to show tooltips for a given range of characters
Describe the solution you'd like
When the user creates a marker region, the associated description text will popup as a marker when the mouse moves over it. If something else happens, like a keypress, the tooltip will disappear and not reappear until the mouse moves away. The tooltip should have a short delay before appearing.
Assigned to myself, since I know how to do this quickly.
The syntax providers use std::set
instead of std::unordered_set
, making lookups O(log n) rather than O(1). I have not found an obvious reason for this, but changing it would mean breaking existing code that uses ZepSyntax::ZepSyntax
, so I’d like to put this up for discussion.
Shouldn't be too hard.
Is your feature request related to a problem? Please describe.
Sometimes we need to distinguish key chords based on timing; for example - CTRL+K is different to CTRL+KO - if there is a long enough pause after the K, then CTRL+K is executed. Or if CTRL+K is pressed then a key that isn't O.
Describe the solution you'd like
Add a key mapping timer to disambiguate the keystrokes. This might be the time to think about a remapping file too; though I am currently not enthused about making keymapping an option.
Describe alternatives you've considered
Currently we require a unique mapping. Currently CTRL+IO is alternative file, but I prefer KO.
Describe the bug
The layout code doesn't do the right thing when you add a hsplit to a vsplitted parent
To Reproduce
Steps to reproduce the behavior:
Before loading any files:
:vsplit, CTRL+P
If you first load a file and split, this doesn't happen!
Expected behavior
A v:split on top of a window at the bottom
In order of preference/usefulness/ease of implementation:
Describe the bug
Github's readme says that when installing for windows, should use "config.bat". Looks like that's invalid.. maybe should be "config_all.bat"?
To Reproduce
Steps to reproduce the behavior:
Follow these steps on Windows: https://github.com/Rezonality/zep#windows
This step doesn't work:
config.bat
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
I suspect should be the config_all.bat ?
Describe the bug
https://github.com/Rezonality/zep/blob/master/include/zep/imgui/console_imgui.h
does not compile due to:
Line 32: No matching constructor for initialization of 'Zep::ZepEditor_ImGui'
Line 36: No member named 'SetFlags' in 'Zep::ZepBuffer'
Line 51 and 52: No member named 'EndLocation' in 'Zep::ZepBuffer'
To Reproduce
Is your feature request related to a problem? Please describe.
Filewatcher doesn't work on all platforms.
Sometimes the client app will want to implement its own filing system.
Zep currently uses from c++14. It's supported everywhere except Mac. On Mac, zep implements the barebones of filesystem to support it (in mfilesystem.cpp).
Filewatcher works on Mac/Linux/Windows, but probably not IOS or Android.
Describe the solution you'd like
Optionally disable the file watcher in the compilation settings.
Add a FileSystem manager which abstracts the local file system.
Describe the bug
ZepSyntax::ZepSyntax
calls QueueUpdateSyntax
, which in turn will call UpdateSyntax
synchronously when no threads are available. This is illegal because UpdateSyntax
is a virtual function and the vtable is not ready at this point.
To Reproduce
ZepEditorFlags::DisableThreads
.ZepBuffer::Load()
→ ZepBuffer::SetText()
→ ZepEditor::SetBufferSyntax()
→ ZepSyntax::ZepSyntax()
Describe the bug
While building on windows using :
cmake -G "Visual Studio 16 2019" -A x64 -DZEP_FEATURE_CPP_FILE_SYSTEM=1 -DBUILD_IMGUI=0 -DBUILD_TESTS=0 -DBUILD_DEMOS=0 ..
This error pops up.
To Reproduce
Steps to reproduce the behavior:
Screenshots
F:\Dropbox\Tech\production\ppc\zep\build>cmake -G "Visual Studio 16 2019" -A x64 -DZEP_FEATURE_CPP_FILE_SYSTEM=1 -DBUILD_IMGUI=0 -DBUILD_TESTS=0 -DBUILD_DEMOS=0 ..
-- CMakeLists: Zep
-- Build Type:
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- The CXX compiler identification is MSVC 19.27.29111.0
-- The C compiler identification is MSVC 19.27.29111.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- System: Windows-10.0.18363
-- Compiler: MSVC
-- Flags: /DWIN32 /D_WINDOWS /W4 /WX /GR /EHsc /MP /Zm127 /Zp16 /D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /D_SCL_SECURE_NO_WARNINGS=1 /D_CRT_NONSTDC_NO_WARNINGS=1 /D_CRT_SECUR
E_NO_WARNINGS=1
-- Arch:
-- TARGET_PC
CMake Error at extensions/CMakeLists.txt:7 (find_package):
By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "SDL2", but
CMake did not find one.
Could not find a package configuration file provided by "SDL2" with any of
the following names:
SDL2Config.cmake
sdl2-config.cmake
Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
"SDL2_DIR" to a directory containing one of the above files. If "SDL2"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
Desktop (please complete the following information):
Just trying out the library on a Linux system gives some errors. Running this on Debian bullseye with cmake 3.18.4:
$ cmake ..
-- CMakeLists: Zep
CMake Error at /usr/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:99 (message):
Could not find toolchain file:
/home/arnaud/src/zep/../vcpkg/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
CMakeLists.txt:32 (project)
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Not sure why it's looking for vcpkg? Is this really needed?
Running with cmake .. -DBUILD_QT=OFF -DBUILD_DEMOS=OFF
gives:
CMake Error at CMakeLists.txt:79 (configure_package_config_file):
Unknown CMake command "configure_package_config_file".
So I guess CMakeLists.txt needs
include(CMakePackageConfigHelpers)
which then succeeds. 👍
This enables selecting a line at a time from the cursor start point.
Hi, I am eyeing Zep as a nicer Scintilla alternative for using in an imgui environment. From looking at the video and screenshots, I can't figure out if scrollbars are supported. Other thing I can't figure out is if using the mouse to select text or set the position of the caret is supported.
Will make zep more generally useful so I can use it day to day and test it.
Describe the bug
I'm trying to use Zep with ImGui, inside the Cinder framework (which has its own keymapping but internally uses GLFW). My keyboard is Spanish, which means that some keys (notably {}[]|@#~\
) are accessed differently than on an standard US keyboard. On a Spanish keyboard, these require pressing the AltGr
key before pressing another key to get the desired character (e.g. bracket/brace). I've managed to handle these keys, by writing a keypress handler (in Cinder) that remaps/translates input keyboard events into simpler events for ImGui. For example, pressing AltGr+´
should give me an open brace {
, but in Zep it thinks control was pressed, since AltGr
behaves like Ctrl+Alt
. So I remapped things in this case:
auto& io = ImGui::GetIO();
io.AddInputCharacter('{');
io.KeyCtrl = io.KeyAlt = false;
And that seems to work...in my program, in the Zep editor, I get a {
inserted (if I don't modify KeyCtrl
, then I get a <C+{>
inserted). But I'm still having problems with other keys (ones that don't require AltGr
), such as +
or ^
. These don't require modifier keys but are different key codes than a US keyboard.
I notice you have special handling for SDL (ref: ZEP_USE_SDK
in editor_imgui.h
) and I'm wondering if I might need something similar to handle my (Cinder/GLFW) codes. I'm looking through the code but am not very familiar with it yet...can you give me any pointers on how I should be approaching this? i.e. how to fix it in the "correct" way? Thanks!
Desktop (please complete the following information):
Describe the bug
Holding down 'j' and then letting go will sometimes skip over several lines after the fact. This seems to be a new bug on Windows RS5, and probably an interaction with SDL, since it doesn't happen on the Qt build.
Desktop (please complete the following information):
Most of the work is done here, but need to add commands and manage a hierarchy of split regions within a tab.
Is your feature request related to a problem? Please describe.
More control required over how the syntax highlighter works
Describe the solution you'd like
The ability to use regex to specify how the syntax highlighting works.
Describe alternatives you've considered
Add more features to the existing engine.
Additional context
Need to evaluate how hard this is to do, and what the alternatives are. Would probably need to fix the threading too.
Describe the bug
When integrating a more recent version of Zep, I was hit by a bug where my whole editor went black. This did not happen when compiling in debug mode, which made it a bit tricky to track down. I finally realised it was because Zep::ZepTheme::GetColor
now returned a Zep::NVec4f const &
(as opposed to a Zep::NVec4f
previously), so when overriding that method I had to make sure I did not return a reference to a temporary because the compiler was (rightfully) assuming I did not care about the returned value.
I studied bf53e9c and could not understand a reason behind returning a reference. From what I found so far, the returned value is always eventually copied to a Zep::Nvec4f
.
This is of course a very common mistake that every C++ programmer should avoid, but it is easily overlooked and I realise that the copiler did not warn me about it.
Also there is currently a real problem in ZepTheme
due to that: since SetLightTheme()
allocates more colors than SetDarkTheme()
, any value returned by GetColor
may be invalidated by a call to SetLightTheme()
.
My personal issue is solved but I’m still suggesting reverting the API change to avoid surprises for other users.
If a region is selected, it should be possible to 'type' over it and replace it with new characters.
Describe the bug
With word wrap on, sometimes stepping down with 'j' at the end of a wrapped line will not step to the next line and get 'stuck'
To Reproduce
Create a long line and an empty line after it, make the editor small so that the text wraps, and use J to step down.
When using, say 'j' to scroll, and scrolling past a long line, the buffer will 'jump' the full distance of the buffer line, instead of just 1 screen line.
Describe the bug
When compiling on VS2019 (with C++17), there are warnings from the inheritance of std::iterator
by utf8::unchecked::iterator
, with the following message:
1>
C:\Users\...\zep\include\zep\mcommon\utf8\unchecked.h
(220,40): warning C4996:std::iterator<std::bidirectional_iterator_tag,utf8::uint32_t,ptrdiff_t,utf8::uint32_t *,utf8::uint32_t &>
: warning STL4015: Thestd::iterator
class template (used as a base class to provide typedefs) is deprecated in C++17. (The<iterator>
header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive fromstd::iterator
. To fix this warning, stop deriving fromstd::iterator
and start providing publicly accessible typedefs namediterator_category
,value_type
,difference_type
,pointer
, andreference
. Note thatvalue_type
is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file..\zep\src\buffer.cpp
)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No warnings.
Desktop (please complete the following information):
Describe the bug
Installing Zep on windows following the steps found on front page of git. Think that Visual studio is being referenced by relative rather than absolute path.
To Reproduce
git clone https://github.com/Rezonality/zep
cd zep
config.bat
Expected behavior
zep to be installed
*Terminal Output
C:\Tools\VIM_Terminal\mutils\zep>config.bat
C:\Tools\VIM_Terminal\mutils\zep>set CURRENT_DIR=C:\Tools\VIM_Terminal\mutils\zep
C:\Tools\VIM_Terminal\mutils\zep>mkdir build 1>nul
C:\Tools\VIM_Terminal\mutils\zep>cd build
C:\Tools\VIM_Terminal\mutils\zep\build>cmake -G "Visual Studio 16 2019" -A x64 -DZEP_FEATURE_CPP_FILE_SYSTEM=1 ..
-- CMakeLists: Zep
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/CMakeDetermineSystem.cmake:110 (message):
Could not find toolchain file:
C:/Tools/VIM_Terminal/mutils/zep/../vcpkg/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
CMakeLists.txt:32 (project)
-- Configuring incomplete, errors occurred!
Desktop (please complete the following information):
Additional context
Used config.bat, not config_all.bat
Installed mutils first
Visual Studio 2019 is installed
Is your feature request related to a problem? Please describe.
Fix column up down with variable width fonts
Describe the solution you'd like
When using variable width fonts, column up down, and potentially other things is broken.
Need to research how hard this is to fix.
Enable switching between tabs when added with :tabedit, for example
Describe the bug
The 10-millisecond sleep
in demo_imgui/main.cpp
appears to cause typed-in keys to be displayed upon key release events rather than key press events, giving the impression that the editor is slow. Removing that code makes everything feel fast again.
To Reproduce
Steps to reproduce the behavior:
build/ZepDemo
Desktop (please complete the following information):
Hello,
Kindly rename the Key definitions in usb_hid_keys.h
as the key defines conflict with many libraries.
I had to change them all to something like #define ZEP_KEY_MOD_LCTRL 0x01
to make them work.
Thank you.
....AWESOME!!!!
Thank you so much for releasing this. I was about to sit down and start exactly this kind of project but you already nailed it. I freaking love you, and IMGUI, and all the other generous giants who's shoulders us little people get to stand on.
I had a problem with my conscience. Maybe not the most appropriate thread but hopefully you are a good sport.
Thanks cmaughan!
I hope to share the "thing I really wanted to make" which this will let me do straight away. But for now: You are the pho-king-meta-bomb-diggity menu item #5, with an extra helping of w00t-sauce!
Allow the user to drag-select a region of text. Mostly for Standard Mode.
Is your feature request related to a problem? Please describe.
Standard mode has the usual keystrokes for notepad, but there are more that would probably be useful.
Describe the solution you'd like
As a first step, a quick review of the common keystrokes in notepad/wordpad/work, for example might throw up some obvious ones we could add
Is your feature request related to a problem? Please describe.
The readme points Zep as a single header increases compile time.
Describe the solution you'd like
Instead of offering a single header, offer a single split, header and cpp file.
This tool can produce this split offering: github.com/shrpnsld/amalgamate.
Describe alternatives you've considered
I tried to find the script that generated the single header for zep but couldn't find.
Additional context
I really like this and plan to use it. Ah, I noticed this project has no release, so I couldn't actually verify the claims on the README on build being increased to see how long it takes (like, enough to bother to do the split).
I am opening this issue to gauge the state of Zep's compatibility with C++17/20 and starting discussion about it.
I was trying to integrate Zep, but it looks like it's sort of stuck in a pre-C++-17 compilation environment.
I was trying to integrate it with Visual Studio 2019 in a C++20 project, and it failed very quickly on https://github.com/Rezonality/zep/blob/master/include/zep/mcommon/utf8/unchecked.h#L220 and https://github.com/Rezonality/zep/blob/master/include/zep/mcommon/signals.h#L296, with the latter being that std::result_of
which was deprecated in C++17 has been completely removed in C++20: https://en.cppreference.com/w/cpp/types/result_of, and the former being basically https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/
These were the top two failures, and I'm not sure what else is going to fail after this.
What's the migration path looking like for moving past C++14 in Zep? Is there a roadmap for it? Should I try cleaning this up, if there's a desire for it?
Thanks!
Originally posted by totalgee February 25, 2022
Many words in LICENSE file are missing, cut or lost :)
Hi, I plan to work on a few features / changes and I’d like to know your opinion about which ones would have a chance to land in your project, and which ones I should keep in my fork because they go beyond the scope you have in mind.
ThreadPool
constructor just throws on these platforms)editor_imgui.cpp
still uses it for some scancodes macros)Describe the bug
can't move cursor to end of line in insert mode, cursor sticks prior to end of line instead of moving to end of line
To Reproduce
enter insert mode, enter text 1234. press escape to enter normal mode. move cursor left and right. It works as expected; i.e. 12[3]4 when moving left, 123[4] when moving right. Pressing right again does nothing.
enter insert mode with cursor on 4. Per vim usual the result is 123|4. Cursor left is 12|34, cursor right is 123|4. A further cursor right stays at 123|4
Expected behavior
a further cursor right in insert mode yields 1234| further right arrows stay at the end of the line
If I make the following patch, insert mode allows the cursor to move to the end of the line, but also allows the cursor to wrap to the next line, so not the same as vim. I was wondering if this rings any bells? I'm not sure what I might be doing wrong. I tried other solutions, but they had side effects, like allowing the cursor in normal mode to go beyond the end of the line. I started to think maybe there needs to be MotionInsertRight to exactly implement a vim behavior; at which point I thought I must be doing something wrong...
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -2491,10 +2491,10 @@ void ZepMode::AddNavigationKeyMaps(bool allowInVisualMode)
keymap_add(navigationMaps, { "<C-h>" }, id_MotionLeftSplit);
// Arrows always navigate in insert mode
- keymap_add({ &m_insertMap }, { "<Down>" }, id_MotionDown);
- keymap_add({ &m_insertMap }, { "<Up>" }, id_MotionUp);
- keymap_add({ &m_insertMap }, { "<Right>" }, id_MotionRight);
- keymap_add({ &m_insertMap }, { "<Left>" }, id_MotionLeft);
+ keymap_add({ &m_insertMap }, { "<Down>" }, id_MotionStandardDown);
+ keymap_add({ &m_insertMap }, { "<Up>" }, id_MotionStandardUp);
+ keymap_add({ &m_insertMap }, { "<Right>" }, id_MotionStandardRight);
+ keymap_add({ &m_insertMap }, { "<Left>" }, id_MotionStandardLeft);
}
void ZepMode::AddSearchKeyMaps()
My key handler is very straightforward, basically lifted straight from the sample, I assume I'm using it correctly? I'm not sure where else to look for a bug in my code. I have verified that zep is definitely in insert mode, and it's definitely invoking MotionRight, so I'm feeling a bit stuck at the moment. MotionStandardRight lets me get to the end of the line for now, but I'd like to know where I've gone off the rails...
// returns true if the event was consumed
bool HandleKeyInput(const ZepBuffer& buffer,
uint32_t key, bool ctrl, bool shift)
{
bool handled = false;
uint32_t mod = (ctrl ? Zep::ModifierKey::Ctrl : 0) |
(shift ? Zep::ModifierKey::Shift : 0);
switch (key)
{
case Zep::ExtKeys::TAB:
case Zep::ExtKeys::ESCAPE:
case Zep::ExtKeys::RETURN:
case Zep::ExtKeys::DEL:
case Zep::ExtKeys::HOME:
case Zep::ExtKeys::END:
case Zep::ExtKeys::BACKSPACE:
case Zep::ExtKeys::RIGHT:
case Zep::ExtKeys::LEFT:
case Zep::ExtKeys::UP:
case Zep::ExtKeys::DOWN:
case Zep::ExtKeys::PAGEDOWN:
case Zep::ExtKeys::PAGEUP:
buffer.GetMode()->AddKeyPress(key, mod);
return true;
}
if (ctrl)
{
if (key == '1')
{
SetGlobalMode(ZepMode_Standard::StaticName());
handled = true;
}
else if (key == '2')
{
SetGlobalMode(ZepMode_Vim::StaticName());
handled = true;
}
else if (key >= 'A' && key <= 'Z')
{
buffer.GetMode()->AddKeyPress(key - 'A' + 'a', mod);
handled = true;
}
else if (key == ' ')
{
buffer.GetMode()->AddKeyPress(' ', mod);
handled = true;
}
}
if (!handled)
{
handled = true;
if (key != '\r')
{
buffer.GetMode()->AddKeyPress(key, mod);
}
}
return handled;
}
Also try to show the tooltip in a sensible place that doesn't obscure the text.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.