Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1030589 - Diff Two Texts

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (8082L/42K).

!7

cmodule DiffTwoTexts {
  S text1, text2;
  S diff;
  switchable bool trim = true;

  visual centerAndSouth(jhsplit3(
    withTitle("Text A (-)", dm_textArea text1()),
    withTitle("Diff", withMargin(wrap(dm_textArea diff()))),
    withTitle("Text B (+)", dm_textArea text2())),
    centeredLine(setToolTip("Also ignores empty lines", dm_checkBox("Ignore Indent", 'trim))));
    
  start {
    dm_watchFields(ll("text1", "text2", "trim"), r doDiff);
  }

  void doDiff enter {
    setField(diff := unidiff(preprocess(text1), preprocess(text2)));
  }

  S preprocess(S s) {
    if (trim) s = fullTrim(s);
    ret s;
  }
}

Author comment

Began life as a copy of #1016809

download  show line numbers  debug dex   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1030589
Snippet name: Diff Two Texts
Eternal ID of this version: #1030589/6
Text MD5: 91459b92d4f4f521c114ba60d3ae0154
Transpilation MD5: 62d3efc3ac58b1d2ddf4d6b09456c322
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-01-13 22:37:13
Source code size: 649 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 20 / 86
Version history: 5 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1030589 & http://1030589.tinybrain.de