Fix handling of whitespace.
Whitespace will no longer be removed from input lines, which fixes pasting multiline strings containing end-of-line or beginning-of-line whitespace.
This commit is contained in:
		
							parent
							
								
									5599665a27
								
							
						
					
					
						commit
						87e6649fc3
					
				
					 1 changed files with 4 additions and 5 deletions
				
			
		| 
						 | 
					@ -178,14 +178,13 @@ bool NixRepl::getLine(string & input, const char * prompt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        char * s = readline(prompt);
 | 
					        char * s = readline(prompt);
 | 
				
			||||||
        if (!s) return false;
 | 
					        if (!s) return false;
 | 
				
			||||||
        string line = chomp(string(s));
 | 
					        input.append(s);
 | 
				
			||||||
        input.append(removeWhitespace(line));
 | 
					 | 
				
			||||||
        input.push_back('\n');
 | 
					        input.push_back('\n');
 | 
				
			||||||
        free(s);
 | 
					        if (!removeWhitespace(s).empty()) {
 | 
				
			||||||
        if (line != "") {
 | 
					            add_history(s);
 | 
				
			||||||
            add_history(line.c_str());
 | 
					 | 
				
			||||||
            append_history(1, 0);
 | 
					            append_history(1, 0);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        free(s);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _isInterrupted = 0;
 | 
					    _isInterrupted = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue