summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/spac-hor.mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2019-02-22 20:29:46 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2019-02-22 20:29:46 +0100
commit7b271baae19db1528fbe6621bdf50af89a5a336b (patch)
tree4fc24a8f2be20aa90e90f6e1bcb62d69f4946235 /tex/context/base/mkiv/spac-hor.mkiv
parent67b9965fe473d18f13ed4c40f1e4e008eb870322 (diff)
downloadcontext-7b271baae19db1528fbe6621bdf50af89a5a336b.tar.gz
2019-02-22 19:43:00
Diffstat (limited to 'tex/context/base/mkiv/spac-hor.mkiv')
-rw-r--r--tex/context/base/mkiv/spac-hor.mkiv56
1 files changed, 36 insertions, 20 deletions
diff --git a/tex/context/base/mkiv/spac-hor.mkiv b/tex/context/base/mkiv/spac-hor.mkiv
index ce747a202..32b7f06fb 100644
--- a/tex/context/base/mkiv/spac-hor.mkiv
+++ b/tex/context/base/mkiv/spac-hor.mkiv
@@ -17,8 +17,9 @@
\registerctxluafile{spac-hor}{}
-\let \parfillrightskip \parfillskip
-\newskip\parfillleftskip
+\let \parfillrightskip \parfillskip
+\newskip \parfillleftskip
+\newconstant\parfillleftmode
\let\v_spac_indentation_current\empty % amount/keyword
@@ -205,6 +206,9 @@
\let\checkindentation\relax
+\installmacrostack\checkindentation
+\installmacrostack\ifindentation
+
\def\spac_indentation_remove
{\ifdim\parindent=\zeropoint \else
\begingroup
@@ -218,21 +222,21 @@
\def\spac_indentation_do_toggle_indeed
{\global\indentationfalse
- \global\let\checkindentation\spac_indentation_no_toggle_indeed
+ \glet\checkindentation\spac_indentation_no_toggle_indeed
\spac_indentation_remove}
\def\spac_indentation_no_toggle_indeed
{\global\indentationtrue
- \global\let\checkindentation\spac_indentation_do_toggle_indeed}
+ \glet\checkindentation\spac_indentation_do_toggle_indeed}
\def\spac_indentation_do_indeed
{\global\indentationtrue}
\def\spac_indentation_do_toggle
- {\global\let\checkindentation\spac_indentation_do_toggle_indeed}
+ {\glet\checkindentation\spac_indentation_do_toggle_indeed}
\def\spac_indentation_no_toggle
- {\global\let\checkindentation\spac_indentation_no_toggle_indeed}
+ {\glet\checkindentation\spac_indentation_no_toggle_indeed}
\def\spac_indentation_check_toggle
{\ifcase\c_spac_indentation_toggle_state
@@ -244,22 +248,22 @@
\fi}
\def\spac_indentation_variant_yes
- {\global\let\checkindentation\spac_indentation_do_indeed}
+ {\glet\checkindentation\spac_indentation_do_indeed}
\def\spac_indentation_no_next_check
{\spac_indentation_remove
- \global\let\checkindentation\spac_indentation_do_indeed}
+ \glet\checkindentation\spac_indentation_do_indeed}
\def\spac_indentation_variant_no % made global
{\ifinpagebody \else
\global\indentationfalse
- \global\let\checkindentation\spac_indentation_no_next_check
+ \glet\checkindentation\spac_indentation_no_next_check
\fi}
\def\nonoindentation % bv bij floats
{\ifinpagebody \else
\global\indentationtrue
- \global\let\checkindentation\spac_indentation_do_indeed
+ \glet\checkindentation\spac_indentation_do_indeed
\fi}
\def\spac_indentation_variant_force
@@ -271,13 +275,13 @@
\fi \fi}
\appendtoks
- \pushmacro\checkindentation
- \pushmacro\ifindentation
+ \push_macro_checkindentation
+ \push_macro_ifindentation
\to \everypushsomestate
\appendtoks
- \popmacro\ifindentation
- \popmacro\checkindentation
+ \pop_macro_ifindentation
+ \pop_macro_checkindentation
\to \everypopsomestate
% public:
@@ -287,16 +291,16 @@
\let\doindentation\spac_indentation_variant_yes % public
\def\dontrechecknextindentation % public (in macros)
- {\global\let\dorechecknextindentation\relax}
+ {\glet\dorechecknextindentation\relax}
\let\dorechecknextindentation\relax % public (in macros)
\unexpanded\def\spac_indentation_check_next_indentation
- {\global\let\dorechecknextindentation\relax
+ {\glet\dorechecknextindentation\relax
\doifelsenextchar\par\donothing\spac_indentation_variant_no} % messy check as next is seldom \par
\def\spac_indentation_variant_auto
- {\global\let\dorechecknextindentation\spac_indentation_check_next_indentation}
+ {\glet\dorechecknextindentation\spac_indentation_check_next_indentation}
%D This one sets up the local indentation behaviour (i.e. either or not
%D a next paragraph will be indented).
@@ -564,6 +568,13 @@
\fi
\fi}
+\unexpanded\def\onlynonbreakablespace
+ {\ifdim\lastskip=\interwordspace
+ \unskip
+ \nonbreakablespace
+ \fi
+ \ignorespaces}
+
% \startbuffer
% \startlines \tt \fixedspaces
% 0~1~~2~~~3~~~~4~~~~~5
@@ -598,12 +609,15 @@
\ifdefined\quad \else
- \unexpanded\def\enskip{\hskip.5\emwidth}
- \unexpanded\def\quad {\hskip \emwidth}
- \unexpanded\def\qquad {\hskip 2\emwidth}
+ \unexpanded\def\enskip{\hskip.5\emwidth\relax}
+ \unexpanded\def\quad {\hskip \emwidth\relax}
+ \unexpanded\def\qquad {\hskip 2\emwidth\relax}
\fi
+\unexpanded\def\negenspace{\kern-.5\emwidth}
+\unexpanded\def\negemspace{\kern- \emwidth}
+
\let\emspace\quad
\unexpanded\def\charspace{ } % the unexpandable \space (as space can also be delimiter for numbers)
@@ -1116,6 +1130,8 @@
\unexpanded\def\spac_spaces_checked_normal {\mathortext\normalspace{\dontleavehmode\normalspace}}%
\unexpanded\def\spac_spaces_checked_fixed {\mathortext\normalspace{\dontleavehmode\fixedspace}}%
+% hm, order matters when we \let in \obeyspaces
+
\installspacemethod \v!on
{\obeyspaces
\let\obeyedspace\spac_spaces_checked_control