1
0
mirror of https://github.com/rfivet/uemacs.git synced 2025-07-05 16:37:38 -04:00

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

View File

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

6
exec.c
View File

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

61
line.c
View File

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

1
main.c
View File

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

View File

@ -12,11 +12,7 @@
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef SVR4
#include <string.h> #include <string.h>
#else
#include <strings.h>
#endif
#include <errno.h> #include <errno.h>
#include "util.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 */ /* Define missing macroes for BSD and CYGWIN environment */
#if BSD #if BSD
#define OLCUC 0000002 # ifndef OLCUC
#define XCASE 0000004 # define OLCUC 0000002
# endif
# ifndef XCASE
# define XCASE 0000004
# endif
#endif #endif
#ifdef __CYGWIN__ /* gcc predefined (see cpp -dM) */ #ifdef __CYGWIN__ /* gcc predefined (see cpp -dM) */