sclass _PrintFlexIndent extends F1<S, Bool> { F1<S, S> makeIndent; bool beginningOfLine = true; *() {} *(F1<S, S> *makeIndent) {} Bool get(S s) { if (empty(s)) false; S prefix = null; if (beginningOfLine) { if (prefix == null) prefix = unnull(callF(makeIndent, s)); print_raw(prefix); } bool nl = s.endsWith("\n"); if (nl) s = dropLast(s); if (contains(s, '\n')) { if (prefix == null) prefix = unnull(callF(makeIndent, s)); if (nempty(prefix)) s = s.replace("\n", "\n" + prefix); } print_raw(s); if (nl) print_raw("\n"); beginningOfLine = nl; false; } }
Began life as a copy of #1008514
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1012700 |
Snippet name: | _PrintFlexIndent |
Eternal ID of this version: | #1012700/3 |
Text MD5: | 9b9fce834dd8ea450e985241c11b36fb |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-10 17:35:36 |
Source code size: | 668 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 429 / 1015 |
Version history: | 2 change(s) |
Referenced in: | #1016665 - _SubModulePrint #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |