admin 管理员组文章数量: 1086019
I'm trying to make a text editor in C for windows (11) using ncurses, as far as i can tell I've gotten every other input working but ctrl+v still pastes from the clipboard.
i already have raw
and nonl
active, and testing the other ctrl+key combinations give the expected results
#include <ncurses/curses.h>
void enableRawMode() {
raw();
nonl();
noecho();
}
int main(void)
{
initscr();
enableRawMode();
keypad(stdscr, TRUE);
timeout(10);
int c;
while (c != 27){
c = wgetch(stdscr);
if (c == ERR) {continue;}
erase();
move(0, 0);
wprintw(stdscr, "escape or ctrl+[ to exit");
move(2, 0);
if (c < 255) {wprintw(stdscr, "%c (%d)", c, c);}
else {wprintw(stdscr, "%d", c);}
refresh();
}
endwin();
return 0;
}
Is there any way of doing this in ncurses? or is this an issue with windows?
I'm trying to make a text editor in C for windows (11) using ncurses, as far as i can tell I've gotten every other input working but ctrl+v still pastes from the clipboard.
i already have raw
and nonl
active, and testing the other ctrl+key combinations give the expected results
#include <ncurses/curses.h>
void enableRawMode() {
raw();
nonl();
noecho();
}
int main(void)
{
initscr();
enableRawMode();
keypad(stdscr, TRUE);
timeout(10);
int c;
while (c != 27){
c = wgetch(stdscr);
if (c == ERR) {continue;}
erase();
move(0, 0);
wprintw(stdscr, "escape or ctrl+[ to exit");
move(2, 0);
if (c < 255) {wprintw(stdscr, "%c (%d)", c, c);}
else {wprintw(stdscr, "%d", c);}
refresh();
}
endwin();
return 0;
}
Is there any way of doing this in ncurses? or is this an issue with windows?
Share Improve this question edited Mar 31 at 21:48 Teeth asked Mar 30 at 3:38 TeethTeeth 514 bronze badges 4- It might be. NCurses only has access to the key codes it gets. If something else (like your terminal emulator or the OS window manager) is grabbing a specific key combination then you will never see it. That said, I have never had any difficulty getting Ctrl-V with NCurses on either Windows or Linux. – Dúthomhas Commented Mar 30 at 4:28
- Quick thought, though: check that “Quick Edit” is disabled in the Windows Console preferences. – Dúthomhas Commented Mar 30 at 4:37
- @Dúthomhas you were right about the terminal emulator being the issue, ctrl+v was bound to paste under Settings > Actions. deleting that shortcut fixed the issue – Teeth Commented Mar 30 at 5:35
- Ah, yes, I had fotten that the new Windows Terminal did that! (I’m using Linux for my home PC these days.) – Dúthomhas Commented Mar 30 at 5:43
1 Answer
Reset to default 3This is, in fact, a problem with windows.
More specifically, the default windows terminal emulator has ctrl+v bound to paste by default.
To fix this, click the dropdown arrow at the top of the window, open settings, and remove the shortcut under the 'Actions' section.
本文标签: cHow to return ctrlv with ncursesStack Overflow
版权声明:本文标题:c - How to return ctrl+v with ncurses? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1743997390a2515829.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论