THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
# ... | |
# This is for what I would consider a standard setup, where TTY's 1 -- 6 are | |
# "linux" terminals and TTY's 7+ are reserved for X windows. You should adjust | |
# it to your setup, accordingly. | |
# | |
# ::: Important ::: You must have both fbterm and screen installed and on your | |
# path for this to work. | |
virtual_terminal="$( tty | grep -oE ....$ )" |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
# <type>: (If applied, this commit will...) <subject> (Max 50 char) | |
# |<---- Using a Maximum Of 50 Characters ---->| | |
# Explain why this change is being made | |
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->| | |
# Provide links or keys to any relevant tickets, articles or other resources | |
# Example: Github issue #23 |
# ... | |
# This is for what I would consider a standard setup, where TTY's 1 -- 6 are | |
# "linux" terminals and TTY's 7+ are reserved for X windows. You should adjust | |
# it to your setup, accordingly. | |
# | |
# ::: Important ::: You must have both fbterm and screen installed and on your | |
# path for this to work. | |
case $(tty) in /dev/tty[0-6]*) |
[ Update 2020-05-31: I won't be maintaining this page or responding to comments anymore (except for perhaps a few exceptional occasions). ]
Most of the terminal emulators auto-detect when a URL appears onscreen and allow to conveniently open them (e.g. via Ctrl+click or Cmd+click, or the right click menu).
It was, however, not possible until now for arbitrary text to point to URLs, just as on webpages.
" File: ~/.vimrc | |
" | |
" Author: Victor I. Afolabi | |
syntax enable | |
colorscheme desert | |
" highlight Normal guibg=none | |
" ============================================================================= |
Synchronized output is merely implementing the feature as inspired by iTerm2 synchronized output,
except that it's not using the rare DCS but rather the well known SM ?
and RM ?
. iTerm2 has now also adopted to use the new syntax instead of using DCS.
When rendering the screen of the terminal, the Emulator usually iterates through each visible grid cell and renders its current state. With applications updating the screen a at higher frequency this can cause tearing.
This mode attempts to mitigate that.
import os | |
from collections import deque | |
from collections.abc import Iterator, Sequence | |
from typing import Final, Protocol | |
class SeekableBytesFile(Protocol): | |
def seek(self, position: int, whence: int = ..., /) -> int: ... | |
def read(self, amount: int, /) -> bytes: ... |
import mmap | |
def get_last_lines(path: str, count: int) -> list[str]: | |
"""Get count last lines from a file.""" | |
with open(path, "r+b") as text_file: | |
text_mmap = mmap.mmap(text_file.fileno(), 0, mmap.ACCESS_READ) | |
position = len(text_mmap) | |
while count and (position := text_mmap.rfind(b"\n", 0, position)) != -1: | |
count -= 1 |
Terminal emulators typically receive window resize events by installing a signal handler for the SIGWINCH signal. Handling of these signals can create challenges due to their inherently racy properties. Resize events must be synchronized with other application state in a safe manner.
Standard control sequences exist to query the current terminal size from the
terminal and receive an in-band control sequence with the window size. However,
this system requires polling - which is not ideal. Usually, SIGWINCH
handling