Merge branch 'rfivet:master' into st_port_2

This commit is contained in:
Rob Gowin 2023-01-14 10:51:34 -06:00 committed by GitHub
commit 3088fbe9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 36 deletions

View File

@ -1,7 +1,7 @@
# README #
µEMACS (ue) on Cygwin/Linux/NetBSD, based on uEmacs/PK (em) from [kernel.org](
https://git.kernel.org/pub/scm/editors/uemacs/uemacs.git/).
µEMACS (ue) on Cygwin/MSYS2/Linux/NetBSD/OpenBSD, based on uEmacs/PK (em)
from [kernel.org](https://git.kernel.org/pub/scm/editors/uemacs/uemacs.git/).
### Changes compare to uEmacs/PK ###
@ -26,6 +26,6 @@ https://git.kernel.org/pub/scm/editors/uemacs/uemacs.git/).
### How to build ###
* dependencies: gcc, gmake, ncurses-devel.
* dependencies: (gcc || clang) && gmake && ncurses-devel.
* make

View File

@ -2,9 +2,9 @@
#ifndef __DEFINES_H__
#define __DEFINES_H__
#if __unix__
#if __unix__ || (defined(__APPLE__) && defined(__MACH__))
# define UNIX 1
# if __NetBSD__
# if __NetBSD__ || __OpenBSD__ || (defined(__APPLE__) && defined(__MACH__))
# define BSD 1
# define POSIX 1
# elif __linux__

6
exec.c
View File

@ -557,9 +557,7 @@ static int dobuf( buffer_p bp) {
/* remove leading spaces */
if( eline != lp->l_text) {
int size = lp->l_used = eol - eline ;
if( size)
memcpy( lp->l_text, eline, size) ;
memmove( lp->l_text, eline, size) ;
eline = lp->l_text ;
eol = &lp->l_text[ size] ;
}
@ -595,7 +593,7 @@ static int dobuf( buffer_p bp) {
/* turn line into a string */
int size = lp->l_used - 6 ;
if( size)
memcpy( lp->l_text, &eline[ 6], size) ;
memmove( lp->l_text, &eline[ 6], size) ;
eline = lp->l_text ;
eline[ size] = 0 ;

61
line.c
View File

@ -293,7 +293,7 @@ boolean linstr( char *instr) {
boolean linsert_byte( int n, int c) {
char *cp1;
char *cp2;
line_p lp2, lp3 ;
line_p lp2 ;
int i ;
assert( (curbp->b_mode & MDVIEW) == 0) ;
@ -308,16 +308,34 @@ boolean linsert_byte( int n, int c) {
if( lp2 == NULL)
return FALSE ;
lp3 = lp1->l_bp ; /* Previous line */
lp3->l_fp = lp2 ; /* Link in */
/* Insert after previous line */
lp1->l_bp->l_fp = lp2 ;
lp2->l_fp = lp1 ;
lp2->l_bp = lp1->l_bp ;
lp1->l_bp = lp2 ;
lp2->l_bp = lp3 ;
for( i = 0 ; i < n ; ++i)
lp2->l_text[ i] = c ;
/* update point of current window */
curwp->w_dotp = lp2 ;
curwp->w_doto = n ;
/* update all windows displaying current buffer */
for( window_p wp = wheadp ; wp != NULL ; wp = wp->w_wndp)
if( wp->w_bufp == curbp) {
/* update top window line */
if( wp->w_linep == lp1)
wp->w_linep = lp2 ;
/* dot at end of buffer is now at beginning of new line */
if( wp->w_dotp == lp1)
wp->w_dotp = lp2 ;
/* mark at end of buffer is now at beginning of new line */
if( wp->w_markp == lp1)
wp->w_markp = lp2 ;
}
return TRUE ;
}
@ -455,29 +473,30 @@ boolean lnewline( void) {
memcpy( lp2->l_text, lp1->l_text, doto) ;
lp1->l_used -= doto ;
memcpy( lp1->l_text, &lp1->l_text[ doto], lp1->l_used) ;
memmove( lp1->l_text, &lp1->l_text[ doto], lp1->l_used) ;
lp2->l_fp = lp1 ;
lp2->l_bp = lp1->l_bp ;
lp1->l_bp = lp2 ;
lp2->l_bp->l_fp = lp2 ;
for( window_p wp = wheadp ; wp != NULL ; wp = wp->w_wndp) {
if( wp->w_linep == lp1)
wp->w_linep = lp2 ;
for( window_p wp = wheadp ; wp != NULL ; wp = wp->w_wndp)
if( wp->w_bufp == curbp) {
if( wp->w_linep == lp1)
wp->w_linep = lp2 ;
if( wp->w_dotp == lp1) {
if( wp->w_doto < doto)
wp->w_dotp = lp2 ;
else
wp->w_doto -= doto ;
}
if( wp->w_dotp == lp1) {
if( wp == curwp || wp->w_doto > doto)
wp->w_doto -= doto ;
else
wp->w_dotp = lp2 ;
}
if (wp->w_markp == lp1) {
if( wp->w_marko < doto)
wp->w_markp = lp2 ;
else
wp->w_marko -= doto ;
}
}
if( wp->w_markp == lp1) {
if( wp->w_marko > doto)
wp->w_marko -= doto ;
else
wp->w_markp = lp2 ;
}
}
return TRUE ;
}

1
main.c
View File

@ -69,6 +69,7 @@
#include "defines.h" /* OS specific customization */
#if UNIX
# include <signal.h>
# include <unistd.h>
#endif
#include "basic.h"

View File

@ -12,11 +12,7 @@
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#ifdef SVR4
#include <string.h>
#else
#include <strings.h>
#endif
#include <errno.h>
#include "util.h"

View File

@ -31,8 +31,12 @@ int ttcol = -1 ; /* Column location of HW cursor */
/* Define missing macroes for BSD and CYGWIN environment */
#if BSD
#define OLCUC 0000002
#define XCASE 0000004
# ifndef OLCUC
# define OLCUC 0000002
# endif
# ifndef XCASE
# define XCASE 0000004
# endif
#endif
#ifdef __CYGWIN__ /* gcc predefined (see cpp -dM) */