mirror of
https://github.com/rfivet/uemacs.git
synced 2024-11-17 18:16:22 -05:00
Extend maximum word length from 127 to 256 when doing paragraph justification (use case: justifying mark down with URL longer than 127).
This commit is contained in:
parent
2babb94944
commit
eceff997c7
13
word.c
13
word.c
@ -22,6 +22,7 @@
|
|||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
|
#define MAXWORDLEN (2 * NSTRING)
|
||||||
#define TAB 0x09 /* a tab character */
|
#define TAB 0x09 /* a tab character */
|
||||||
|
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
@ -354,7 +355,7 @@ static int inword( void) {
|
|||||||
int fillpara(int f, int n)
|
int fillpara(int f, int n)
|
||||||
{
|
{
|
||||||
unicode_t c; /* current char during scan */
|
unicode_t c; /* current char during scan */
|
||||||
unicode_t wbuf[NSTRING];/* buffer for current word */
|
unicode_t wbuf[ MAXWORDLEN] ; /* buffer for current word */
|
||||||
int wordlen; /* length of current word */
|
int wordlen; /* length of current word */
|
||||||
int clength; /* position on line during fill */
|
int clength; /* position on line during fill */
|
||||||
int i; /* index during word copy */
|
int i; /* index during word copy */
|
||||||
@ -408,11 +409,11 @@ int fillpara(int f, int n)
|
|||||||
/* if not a separator, just add it in */
|
/* if not a separator, just add it in */
|
||||||
if (c != ' ' && c != '\t') {
|
if (c != ' ' && c != '\t') {
|
||||||
dotflag = (c == '.'); /* was it a dot */
|
dotflag = (c == '.'); /* was it a dot */
|
||||||
if (wordlen < NSTRING - 1)
|
if (wordlen < MAXWORDLEN)
|
||||||
wbuf[wordlen++] = c;
|
wbuf[wordlen++] = c;
|
||||||
} else if (wordlen) {
|
} else if (wordlen) {
|
||||||
/* at a word break with a word waiting */
|
/* at a word break with a word waiting */
|
||||||
/* calculate tentitive new length with word added */
|
/* calculate tentative new length with word added */
|
||||||
newlength = clength + 1 + wordlen;
|
newlength = clength + 1 + wordlen;
|
||||||
if (newlength <= fillcol) {
|
if (newlength <= fillcol) {
|
||||||
/* add word to current line */
|
/* add word to current line */
|
||||||
@ -453,7 +454,7 @@ int fillpara(int f, int n)
|
|||||||
int justpara(int f, int n)
|
int justpara(int f, int n)
|
||||||
{
|
{
|
||||||
unicode_t c; /* current char durring scan */
|
unicode_t c; /* current char durring scan */
|
||||||
unicode_t wbuf[NSTRING];/* buffer for current word */
|
unicode_t wbuf[ MAXWORDLEN] ; /* buffer for current word */
|
||||||
int wordlen; /* length of current word */
|
int wordlen; /* length of current word */
|
||||||
int clength; /* position on line during fill */
|
int clength; /* position on line during fill */
|
||||||
int i; /* index during word copy */
|
int i; /* index during word copy */
|
||||||
@ -513,11 +514,11 @@ int justpara(int f, int n)
|
|||||||
|
|
||||||
/* if not a separator, just add it in */
|
/* if not a separator, just add it in */
|
||||||
if (c != ' ' && c != '\t') {
|
if (c != ' ' && c != '\t') {
|
||||||
if (wordlen < NSTRING - 1)
|
if (wordlen < MAXWORDLEN)
|
||||||
wbuf[wordlen++] = c;
|
wbuf[wordlen++] = c;
|
||||||
} else if (wordlen) {
|
} else if (wordlen) {
|
||||||
/* at a word break with a word waiting */
|
/* at a word break with a word waiting */
|
||||||
/* calculate tentitive new length with word added */
|
/* calculate tentative new length with word added */
|
||||||
newlength = clength + 1 + wordlen;
|
newlength = clength + 1 + wordlen;
|
||||||
if (newlength <= fillcol) {
|
if (newlength <= fillcol) {
|
||||||
/* add word to current line */
|
/* add word to current line */
|
||||||
|
Loading…
Reference in New Issue
Block a user