|  | @@ -47,6 +47,7 @@ int strToUnicode(uint32_t* target, unsigned char* const src){
 | 
											
												
													
														|  |      uint32_t UC,adv,i=0; unsigned char* source=src; while(target[i]=laToUnicode(source, &adv)) { source+=adv; i++; } target[i]=0; return i;
 |  |      uint32_t UC,adv,i=0; unsigned char* source=src; while(target[i]=laToUnicode(source, &adv)) { source+=adv; i++; } target[i]=0; return i;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  int strToUTF8Lim(unsigned char* target, uint32_t* const src, int count){
 |  |  int strToUTF8Lim(unsigned char* target, uint32_t* const src, int count){
 | 
											
												
													
														|  | 
 |  | +    if(count<=0){ return 0; }
 | 
											
												
													
														|  |      uint32_t* source=src; unsigned char* out=target; int i=0; while(laToUTF8(*source, out, &out)){ source++; i++; if(i>=count) break; } *out=0; return out-target;
 |  |      uint32_t* source=src; unsigned char* out=target; int i=0; while(laToUTF8(*source, out, &out)){ source++; i++; if(i>=count) break; } *out=0; return out-target;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  int strToUTF8(unsigned char* target, uint32_t* const src){
 |  |  int strToUTF8(unsigned char* target, uint32_t* const src){
 | 
											
										
											
												
													
														|  | @@ -1989,7 +1990,7 @@ void strBeginEdit(laStringEdit **se, char *FullStr){
 | 
											
												
													
														|  |          laStringLine *sl = memAcquireSimple(sizeof(laStringLine));
 |  |          laStringLine *sl = memAcquireSimple(sizeof(laStringLine));
 | 
											
												
													
														|  |          lstAppendItem(&nse->Lines, sl); nse->TotalLines=1;
 |  |          lstAppendItem(&nse->Lines, sl); nse->TotalLines=1;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    laStringLine *sl = strGetCursorLine(nse, 0); int len=strlen(sl->Buf);
 |  | 
 | 
											
												
													
														|  | 
 |  | +    laStringLine *sl = strGetCursorLine(nse, 0); int len=strlenU(sl->Buf);
 | 
											
												
													
														|  |      if(len<nse->CursorBefore){ nse->CursorBefore=len; }
 |  |      if(len<nse->CursorBefore){ nse->CursorBefore=len; }
 | 
											
												
													
														|  |      *se=nse;
 |  |      *se=nse;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
										
											
												
													
														|  | @@ -2002,8 +2003,9 @@ char* strGetEditString(laStringEdit *se, int SelectionOnly){
 | 
											
												
													
														|  |          if(SelectionOnly && Line<se->BeginLine){ continue; }
 |  |          if(SelectionOnly && Line<se->BeginLine){ continue; }
 | 
											
												
													
														|  |          if(SelectionOnly && Line==se->BeginLine){ starti=se->BeginBefore; }
 |  |          if(SelectionOnly && Line==se->BeginLine){ starti=se->BeginBefore; }
 | 
											
												
													
														|  |          int tlen=strlenU(&sl->Buf[starti]); int Extra=sl->Item.pNext?2:1;
 |  |          int tlen=strlenU(&sl->Buf[starti]); int Extra=sl->Item.pNext?2:1;
 | 
											
												
													
														|  | 
 |  | +        if(SelectionOnly){ if(Line<se->EndLine){ Extra=2; }else{ Extra=1; } }
 | 
											
												
													
														|  |          arrEnsureLength(&result, (len+tlen)*4+Extra, &max, sizeof(char));
 |  |          arrEnsureLength(&result, (len+tlen)*4+Extra, &max, sizeof(char));
 | 
											
												
													
														|  | -        if(SelectionOnly && Line==se->EndLine){ endat=NextChar+se->EndBefore-starti; }
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if(SelectionOnly && Line==se->EndLine){ endat=se->EndBefore-starti; }
 | 
											
												
													
														|  |          NextChar+=strToUTF8Lim(&result[NextChar], &sl->Buf[starti], endat); len+=tlen;
 |  |          NextChar+=strToUTF8Lim(&result[NextChar], &sl->Buf[starti], endat); len+=tlen;
 | 
											
												
													
														|  |          if(Extra==2){ result[NextChar]='\n'; NextChar+=1; }
 |  |          if(Extra==2){ result[NextChar]='\n'; NextChar+=1; }
 | 
											
												
													
														|  |          if(SelectionOnly && Line==se->EndLine){ break; }
 |  |          if(SelectionOnly && Line==se->EndLine){ break; }
 |