Ncurse implements window stretching and text does not wrap - ncurses

How to use NCurse to achieve window stretching, text does not wrap. Like the interface of HTOP, the window is stretched, and the process is not forced to show a line break, but hidden

Related

PYQT5 Open menu on cursor position in QTextEditor

I have a QTextEditor which I would like to open a menu for user to choose when he press Ctrl+Space.
I was able to capture the key events and create the menu and trigger it.
My problem is to open the menu on the text cursor position.
How do i get the QPoint of the textcursor and not the mouse position?
QTextEdit.cursorRect returns a rectangle (in viewport coordinates) that includes the cursor.
You're probably imlementing autocompletion/intellisense, it which case I'd recommend using QCompleter instead of QMenu. Take a look at Custom Completer Example.
You can override QTextEdit.keyPressEvent or use eventFilter to capture Ctrl+Space shortcuts and call completer.complete(rect) to show popup.

vim x/y scrollbar hiding my commands and being really anoying

i'm a new vim user since 2 weeks and i've currently have my biggest trouble for the moment on vim.
i always have a x and y scrollbar on my vim and the x one is very anoying because it cover my commands.
here is a screenshot of the scrollbars that appears when i use terminal inside of vim using `:term` / `:!dir` or even when i save my vimrc or source it (`:so ~/.vimrc`)
if there is any solutions to it i will be really grateful, thanks for reading
This is an issue with your layout settings in Powershell and Ubuntu. Right click on the top bar of either program, go to Properties and then go to the Layout tab. You can check the Wrap text output on resize box and that should get rid of your horizontal scrollbar, thereby allowing you to use Vim as normal. Alternatively, in the same menu, you can decrease the width of the screen buffer size so that it is smaller than the width of the window size.

ncurses scroll text contents of window

I'm looking for definitive answers about scrolling methods in a window or pad using ncurses.
I would like to display a stdout stream which quickly fills the number of available lines on the screen and starts to overflow. Using stdio the terminal simply scrolls the contents. But with ncurses as far as I understand the output is only limited to the screen area. Is this entirely accurate?
Is the usual approach then to put the entire contents of stdout into a buffer and then read specific parts of the buffer into a ncurses window or pad? Which other methods are there to scroll text using ncurses?
You may have overlooked scrollok:
The scrollok option controls what happens when the cursor
of a window is moved off the edge of the window or
scrolling region, either as a result of a newline action
on the bottom line, or typing the last character of the
last line. If disabled, (bf is FALSE), the cursor is left
on the bottom line. If enabled, (bf is TRUE), the window
is scrolled up one line (Note that to get the physical
scrolling effect on the terminal, it is also necessary to
call idlok).
Using that, you can write to any window, and have it scroll up—just like stdio.
Further reading:
clearok, idlok, idcok, immedok, leaveok, setscrreg,
wsetscrreg, scrollok, nl, nonl - curses output options
scroll, scrl, wscrl - scroll a curses window
Use scrollok like:
scrollok(win, TRUE);

Block keyboard for embedded xterm, in PyQt4

I'm trying to embed xterm in a PyQt application window for tailing a log file. However, I want to block keyboard input from the user in the embedded terminal, so that they don't, for example, press CTRL-C or CTRL-D, and kill the process.
I'm able to embed the terminal just fine. Is there a setting for xterm or PyQt that can be used to block user input? I want this to be a read-only terminal, that just displays the content of the log file.
I've searched the manpage for xterm, and haven't found anything.
The way to approach this would be to construct a transparent (actually "uncolored") window which overlays the embedded xterm window.
There is an example described in Basic X Window keyboard and mouse input blocking which is essentially a screensaver written in Python. For lower-level (X documentation) on window properties, the links in How to prevent an X Window from receiving user input? may be useful to you.
The main problems to solve would be (in your program) how to ensure that the overlaid window comes on top, and of course how to keep it transparent (since that diverges from the example). The latter is more complicated:
Transparent window in Xwindow parent
Empty or transparent window with Xlib showing border lines only

How to modify zoom level of gnome-terminal programatically?

One can modify the zoom level in the gnome-terminal by pressing C-+/-. I would like to modify the zoom level automatically in response to window size change (number of columns). Alternatively, are there terminals which support that? I am using a tiling window manager and would like to have the font adjust to the size of the window so that there is roughly constant number of characters in a line.

Resources