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

21
LINES

< > BotCompany Repo | #1006440 // Concepts (Auto-Saving Text Editor)

JavaX fragment (include)

1  
concept Session {}
2  
3  
concept Event {
4  
  new Ref<Session> session;
5  
}
6  
7  
Event > EChange {
8  
  int startIndex, endIndex;
9  
  S text;
10  
}
11  
12  
Event > ECaret {
13  
  int pos;
14  
}  
15  
16  
static S replayEdit(EChange change, S text) {
17  
  if (change == null) ret text;
18  
  ret substring(text, 0, change.startIndex)
19  
    + change.text
20  
    + substring(text, change.endIndex);
21  
}

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: #1006440
Snippet name: Concepts (Auto-Saving Text Editor)
Eternal ID of this version: #1006440/1
Text MD5: 3ed5be937de1332bb1b37c53a06644c3
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-01-03 16:31:41
Source code size: 360 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 534 / 994
Referenced in: [show references]