Compare commits
	
		
			9 Commits
		
	
	
		
			9a67e076a9
			...
			v1.1.1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						ba86961ba5
	
				 | 
					
					
						|||
| 
						
						
							
						
						0cdb4989e5
	
				 | 
					
					
						|||
| 
						
						
							
						
						6de940fe96
	
				 | 
					
					
						|||
| 
						
						
							
						
						6bd8c1db2f
	
				 | 
					
					
						|||
| 
						
						
							
						
						56efe9c6a9
	
				 | 
					
					
						|||
| 
						
						
							
						
						8a17e674f8
	
				 | 
					
					
						|||
| 
						
						
							
						
						bd0ee66c19
	
				 | 
					
					
						|||
| 
						
						
							
						
						6f6efe077b
	
				 | 
					
					
						|||
| 
						
						
							
						
						ee5c41b2bf
	
				 | 
					
					
						
							
								
								
									
										32
									
								
								.clang-format
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								.clang-format
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					# clang-format is fairly limited, and these rules are approximate:
 | 
				
			||||||
 | 
					#  - array initializers can get terribly mangled with clang-format 12.0,
 | 
				
			||||||
 | 
					#  - sometimes it still aligns with space characters,
 | 
				
			||||||
 | 
					#  - struct name NL { NL ... NL } NL name; is unachievable.
 | 
				
			||||||
 | 
					BasedOnStyle: GNU
 | 
				
			||||||
 | 
					ColumnLimit: 80
 | 
				
			||||||
 | 
					IndentWidth: 4
 | 
				
			||||||
 | 
					TabWidth: 4
 | 
				
			||||||
 | 
					UseTab: ForContinuationAndIndentation
 | 
				
			||||||
 | 
					BreakBeforeBraces: Allman
 | 
				
			||||||
 | 
					SpaceAfterCStyleCast: true
 | 
				
			||||||
 | 
					AlignAfterOpenBracket: DontAlign
 | 
				
			||||||
 | 
					AlignOperands: DontAlign
 | 
				
			||||||
 | 
					AlignConsecutiveMacros: Consecutive
 | 
				
			||||||
 | 
					AllowAllArgumentsOnNextLine: false
 | 
				
			||||||
 | 
					AllowAllParametersOfDeclarationOnNextLine: false
 | 
				
			||||||
 | 
					IndentGotoLabels: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# IncludeCategories has some potential, but it may also break the build.
 | 
				
			||||||
 | 
					# Note that the documentation says the value should be "Never".
 | 
				
			||||||
 | 
					SortIncludes: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This is a compromise, it generally works out aesthetically better.
 | 
				
			||||||
 | 
					BinPackArguments: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Unfortunately, this can't be told to align to column 40 or so.
 | 
				
			||||||
 | 
					SpacesBeforeTrailingComments: 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# liberty-specific macro body wrappers.
 | 
				
			||||||
 | 
					MacroBlockBegin: "BLOCK_START"
 | 
				
			||||||
 | 
					MacroBlockEnd: "BLOCK_END"
 | 
				
			||||||
 | 
					ForEachMacros: ["LIST_FOR_EACH"]
 | 
				
			||||||
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -7,3 +7,5 @@
 | 
				
			|||||||
/nncmpp.files
 | 
					/nncmpp.files
 | 
				
			||||||
/nncmpp.creator*
 | 
					/nncmpp.creator*
 | 
				
			||||||
/nncmpp.includes
 | 
					/nncmpp.includes
 | 
				
			||||||
 | 
					/nncmpp.cflags
 | 
				
			||||||
 | 
					/nncmpp.cxxflags
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
cmake_minimum_required (VERSION 3.0)
 | 
					cmake_minimum_required (VERSION 3.0)
 | 
				
			||||||
project (nncmpp VERSION 1.1.0 LANGUAGES C)
 | 
					project (nncmpp VERSION 1.1.1 LANGUAGES C)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Moar warnings
 | 
					# Moar warnings
 | 
				
			||||||
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
 | 
					if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
 | 
				
			||||||
@@ -24,14 +24,17 @@ option (USE_SYSTEM_TERMO
 | 
				
			|||||||
if (USE_SYSTEM_TERMO)
 | 
					if (USE_SYSTEM_TERMO)
 | 
				
			||||||
	if (NOT Termo_FOUND)
 | 
						if (NOT Termo_FOUND)
 | 
				
			||||||
		message (FATAL_ERROR "System termo library not found")
 | 
							message (FATAL_ERROR "System termo library not found")
 | 
				
			||||||
	endif (NOT Termo_FOUND)
 | 
						endif ()
 | 
				
			||||||
else ()
 | 
					else ()
 | 
				
			||||||
 | 
						# We don't want the library to install, but EXCLUDE_FROM_ALL ignores tests
 | 
				
			||||||
	add_subdirectory (termo EXCLUDE_FROM_ALL)
 | 
						add_subdirectory (termo EXCLUDE_FROM_ALL)
 | 
				
			||||||
	# We don't have many good choices when we don't want to install it and want
 | 
						file (WRITE ${PROJECT_BINARY_DIR}/CTestCustom.cmake
 | 
				
			||||||
	# to support older versions of CMake; this is a relatively clean approach
 | 
							"execute_process (COMMAND ${CMAKE_COMMAND} --build termo)")
 | 
				
			||||||
	# (other possibilities: setting a variable in the parent scope, using a
 | 
					
 | 
				
			||||||
	# cache variable, writing a special config file with build paths in it and
 | 
						# We don't have many good choices; this is a relatively clean approach
 | 
				
			||||||
	# including it here, or setting a custom property on the targets).
 | 
						# (other possibilities: setting a variable in the parent scope, using
 | 
				
			||||||
 | 
						# a cache variable, writing a special config file with build paths in it
 | 
				
			||||||
 | 
						# and including it here, or setting a custom property on the targets)
 | 
				
			||||||
	get_directory_property (Termo_INCLUDE_DIRS
 | 
						get_directory_property (Termo_INCLUDE_DIRS
 | 
				
			||||||
		DIRECTORY termo INCLUDE_DIRECTORIES)
 | 
							DIRECTORY termo INCLUDE_DIRECTORIES)
 | 
				
			||||||
	set (Termo_LIBRARIES termo-static)
 | 
						set (Termo_LIBRARIES termo-static)
 | 
				
			||||||
@@ -42,7 +45,7 @@ option (WITH_FFTW "Use FFTW to enable spectrum visualisation" ${fftw_FOUND})
 | 
				
			|||||||
if (WITH_FFTW)
 | 
					if (WITH_FFTW)
 | 
				
			||||||
	if (NOT fftw_FOUND)
 | 
						if (NOT fftw_FOUND)
 | 
				
			||||||
		message (FATAL_ERROR "FFTW not found")
 | 
							message (FATAL_ERROR "FFTW not found")
 | 
				
			||||||
	endif()
 | 
						endif ()
 | 
				
			||||||
endif ()
 | 
					endif ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
include_directories (${Unistring_INCLUDE_DIRS}
 | 
					include_directories (${Unistring_INCLUDE_DIRS}
 | 
				
			||||||
@@ -51,16 +54,18 @@ include_directories (${Unistring_INCLUDE_DIRS}
 | 
				
			|||||||
link_directories (${curl_LIBRARY_DIRS} ${fftw_LIBRARY_DIRS})
 | 
					link_directories (${curl_LIBRARY_DIRS} ${fftw_LIBRARY_DIRS})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Configuration
 | 
					# Configuration
 | 
				
			||||||
include (CheckFunctionExists)
 | 
					 | 
				
			||||||
set (CMAKE_REQUIRED_LIBRARIES ${Ncursesw_LIBRARIES})
 | 
					 | 
				
			||||||
CHECK_FUNCTION_EXISTS ("resizeterm" HAVE_RESIZETERM)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
 | 
					if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
 | 
				
			||||||
	# Need this for SIGWINCH in FreeBSD and OpenBSD respectively;
 | 
						# Need this for SIGWINCH in FreeBSD and OpenBSD respectively;
 | 
				
			||||||
	# our POSIX version macros make it undefined
 | 
						# our POSIX version macros make it undefined
 | 
				
			||||||
	add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1)
 | 
						add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1)
 | 
				
			||||||
 | 
					elseif (APPLE)
 | 
				
			||||||
 | 
						add_definitions (-D_DARWIN_C_SOURCE)
 | 
				
			||||||
endif ()
 | 
					endif ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					include (CheckFunctionExists)
 | 
				
			||||||
 | 
					set (CMAKE_REQUIRED_LIBRARIES ${Ncursesw_LIBRARIES})
 | 
				
			||||||
 | 
					CHECK_FUNCTION_EXISTS ("resizeterm" HAVE_RESIZETERM)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# -lm may or may not be a part of libc
 | 
					# -lm may or may not be a part of libc
 | 
				
			||||||
foreach (extra m)
 | 
					foreach (extra m)
 | 
				
			||||||
	find_library (extra_lib_${extra} ${extra})
 | 
						find_library (extra_lib_${extra} ${extra})
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								NEWS
									
									
									
									
									
								
							@@ -1,3 +1,10 @@
 | 
				
			|||||||
 | 
					1.1.1 (2021-11-04)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * Terminal focus in/out events no longer ring the terminall bell
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * Made mouse work in non-rxvt terminals with recent xterm terminfo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1.1.0 (2021-10-21)
 | 
					1.1.0 (2021-10-21)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 * Now requesting and processing terminal de/focus events,
 | 
					 * Now requesting and processing terminal de/focus events,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ Building
 | 
				
			|||||||
--------
 | 
					--------
 | 
				
			||||||
Build dependencies: CMake, pkg-config, asciidoctor, liberty (included),
 | 
					Build dependencies: CMake, pkg-config, asciidoctor, liberty (included),
 | 
				
			||||||
                    termo (included) +
 | 
					                    termo (included) +
 | 
				
			||||||
Runtime dependencies: ncursesw, libunistring, cURL
 | 
					Runtime dependencies: ncursesw, libunistring, cURL, fftw3 (optional)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 $ git clone --recursive https://git.janouch.name/p/nncmpp.git
 | 
					 $ git clone --recursive https://git.janouch.name/p/nncmpp.git
 | 
				
			||||||
 $ mkdir nncmpp/build
 | 
					 $ mkdir nncmpp/build
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								nncmpp.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								nncmpp.c
									
									
									
									
									
								
							@@ -78,9 +78,7 @@ enum
 | 
				
			|||||||
#include <math.h>
 | 
					#include <math.h>
 | 
				
			||||||
#include <locale.h>
 | 
					#include <locale.h>
 | 
				
			||||||
#include <termios.h>
 | 
					#include <termios.h>
 | 
				
			||||||
#ifndef TIOCGWINSZ
 | 
					 | 
				
			||||||
#include <sys/ioctl.h>
 | 
					#include <sys/ioctl.h>
 | 
				
			||||||
#endif  // ! TIOCGWINSZ
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ncurses is notoriously retarded for input handling, we need something
 | 
					// ncurses is notoriously retarded for input handling, we need something
 | 
				
			||||||
// different if only to receive mouse events reliably.
 | 
					// different if only to receive mouse events reliably.
 | 
				
			||||||
@@ -110,7 +108,7 @@ enum
 | 
				
			|||||||
static void
 | 
					static void
 | 
				
			||||||
update_curses_terminal_size (void)
 | 
					update_curses_terminal_size (void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#if defined (HAVE_RESIZETERM) && defined (TIOCGWINSZ)
 | 
					#if defined HAVE_RESIZETERM && defined TIOCGWINSZ
 | 
				
			||||||
	struct winsize size;
 | 
						struct winsize size;
 | 
				
			||||||
	if (!ioctl (STDOUT_FILENO, TIOCGWINSZ, (char *) &size))
 | 
						if (!ioctl (STDOUT_FILENO, TIOCGWINSZ, (char *) &size))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -2588,10 +2586,12 @@ app_init_bindings (const char *keymap,
 | 
				
			|||||||
static bool
 | 
					static bool
 | 
				
			||||||
app_process_termo_event (termo_key_t *event)
 | 
					app_process_termo_event (termo_key_t *event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (event->type == TERMO_TYPE_FOCUS)
 | 
						bool handled = false;
 | 
				
			||||||
 | 
						if ((handled = event->type == TERMO_TYPE_FOCUS))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		g.focused = !!event->code.focused;
 | 
							g.focused = !!event->code.focused;
 | 
				
			||||||
		app_invalidate ();
 | 
							app_invalidate ();
 | 
				
			||||||
 | 
							// Senseless fall-through
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct binding dummy = { *event, 0, 0 }, *binding;
 | 
						struct binding dummy = { *event, 0, 0 }, *binding;
 | 
				
			||||||
@@ -2601,7 +2601,7 @@ app_process_termo_event (termo_key_t *event)
 | 
				
			|||||||
			sizeof *binding, app_binding_cmp)))
 | 
								sizeof *binding, app_binding_cmp)))
 | 
				
			||||||
			return app_editor_process_action (binding->action);
 | 
								return app_editor_process_action (binding->action);
 | 
				
			||||||
		if (event->type != TERMO_TYPE_KEY || event->modifiers != 0)
 | 
							if (event->type != TERMO_TYPE_KEY || event->modifiers != 0)
 | 
				
			||||||
			return false;
 | 
								return handled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		line_editor_insert (&g.editor, event->code.codepoint);
 | 
							line_editor_insert (&g.editor, event->code.codepoint);
 | 
				
			||||||
		app_invalidate ();
 | 
							app_invalidate ();
 | 
				
			||||||
@@ -2620,7 +2620,7 @@ app_process_termo_event (termo_key_t *event)
 | 
				
			|||||||
		if (app_goto_tab ((n == 0 ? 10 : n) - 1))
 | 
							if (app_goto_tab ((n == 0 ? 10 : n) - 1))
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return false;
 | 
						return handled;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// --- Current tab -------------------------------------------------------------
 | 
					// --- Current tab -------------------------------------------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								termo
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								termo
									
									
									
									
									
								
							 Submodule termo updated: 94a77a10d8...8265f075b1
									
								
							
		Reference in New Issue
	
	Block a user